A A

Tag Archive | "code"

Calculate Your GPA Using this Bash Script

Thursday, May 21, 2009

0 Comments

This Bash script is used to calculate your Grade Point Average (GPA) on the command line. Usage might not be intuitive. Please see the usage function or just run the script without passing it any arguments. The gval function should be edited to reflect your own region or university. It has been written and tested on [...]

I Can’t Live Without My vim Config

Saturday, April 11, 2009

0 Comments

I have updated the vim page with my vimrc/gvimrc configs. Instead of repeating myself, I will quote some parts of the page .. More details and the vim config itself here I recommend turning backups on if you have them off. I personally hate having the ~ files all over my OS, so I keep them along [...]

How to Maintain Static Sites with Git & Jekyll

Tuesday, March 31, 2009

4 Comments

Static sites in this context just means non-database driven sites. Your static site can be an elaborate PHP script or just a few markup and image files. For this I am using Jekyll – A neat Ruby gem that makes your static sites dynamic. It lets you create layouts and embed custom variables in your [...]

Multiple Monitors vs One Big Screen

Monday, February 16, 2009

1 Comment

Most people I know who’ve never used dual screen ask me why I don’t invest in one big monitor instead. There’s a big difference between having multiple monitors and having just one, no matter the size. Though which is better really depends on what you’re using the computer for, what OS/window manager you’re using, and [...]

Script to Quickly Setup WebApp Environment and Domain

Saturday, October 11, 2008

0 Comments

Just sharing a script I wrote to quickly deploy Wordpress (and eventually a few other webapps) sites, which somebody might find useful. This uses Linode’s API* to add the domain name to the DNS server along with some subdomains. If you’re using another server, (Slicehost, your own, etc), you can alter the dns class to [...]

How To Use Fixtures to Populate Your Database in Rails

Friday, July 11, 2008

0 Comments

UPDATE: I’ve been using this method for awhile now: http://railspikes.com/2008/2/1/loading-seed-data Seed data is data that the app is dependent on. It is data that has to exist if you were to wipe the database clean and reload your schema. Some examples would be a list of cities/states, a list of categories, or the initial ‘admin’ user [...]

How to POST Form Data Using Ruby

Thursday, April 24, 2008

1 Comment

POSTing data on web forms is essential for writing tools and services that interact with resources already available on the web. You can grab information from your Gmail account, add a new thread to a forum from your own app, etc. The following is a brief example on how this can be done in Ruby [...]

GitHub Now Open to the Public

Sunday, April 13, 2008

0 Comments

GitHub.com, the “easiest (and prettiest)” version control system, is now open to the public. It’s free for Open Source programs (albeit limited to 100MB of space). If you’re not sure what git (or Revision Control) is, here are some resources: Wikipedia on Revision Control (excerpt) “Revision control (also known as version control (system) (VCS), source control or (source) [...]

Introduction to Validations & Validation Error Handling in Rails

Friday, February 8, 2008

4 Comments

Validations in Ruby on Rails are essentially nothing more than methods that ensure that the data in a model is valid before saving it to the database. Traditionally, we validate data coming in using conditional expressions (for example, if email != NULL or if passwd==passwd_confirmation). This task is essential, but boring and tedious, but Rails’ [...]