Skip to content

Instantly share code, notes, and snippets.

View mrchrisadams's full-sized avatar

Chris Adams mrchrisadams

View GitHub Profile
## This helper should return an image for each bank, depending on the value of current
def show_bank_logo(current)
case current
when /barclay/
logo_image = 'barclays'
when /coop/
logo_image = 'cooperative'
when /hsbc/
require 'csv'
codes = []
CSV.open("codes.csv", 'r') do |row|
# put the contents of the first column in each row in codes.csv,
# into the second column of each of codes
codes[row[1].to_i] = row[0]
end
<% @articles.each do |article| %>
<li>
<% form_for :article article do |f| -%>
<%= f.title %> - <%= f.published_at %>
<% end -%>
</li>
<% end %>
#!/usr/bin/ruby
require 'rubygems'
require 'net/http'
require 'rio'
body = Net::HTTP.get 'minneapolisfuckingrocks.blogspot.com', '/2009/01/diplo-remix-collection.html'
links = body.scan(/http:\/\/[a-zA-Z0-9_\.\/]*mp3{1}/)
links.each {|link| rio(link) > rio(File.basename(link))}
#!/usr/bin/env python
# encoding: utf-8
"""
makewidget.py
Created by Chris Adams on 2009-03-03.
"""
from PIL import Image, ImageFont, ImageDraw
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 16584 7544 2212 37116 2 2 5 5 17 21 0 0 99 0
0 0 16584 7544 2220 37108 0 0 0 8 10 13 0 0 100 0
0 0 16584 7544 2220 37108 0 0 0 0 8 12 0 0 100 0
0 0 16584 7544 2220 37108 0 0 0 0 9 15 0 0 100 0
0 0 16584 7544 2228 37100 0 0 0 2 8 13 0 0 100 0
<Proxy balancer://loco>
BalancerMember http://localhost:15000
BalancerMember http://localhost:15001
BalancerMember http://localhost:15002
BalancerMember http://localhost:15003
BalancerMember http://localhost:15004
</Proxy>
<VirtualHost *:80>
@mrchrisadams
mrchrisadams / gist:78678
Created March 13, 2009 18:13 — forked from chrismear/gist:78676
my gems
sudo aptitude search mysql | grep "^i"
i libdbd-mysql-perl - A Perl5 database interface to the MySQL da
i libmysqlclient15-dev - MySQL database development files
i libmysqlclient15off - MySQL database client library
i mysql-client-5.0 - MySQL database client binaries
i mysql-common - MySQL database common files
i mysql-server - MySQL database server (metapackage dependi
i mysql-server-5.0 - MySQL database server binaries
i php5-mysql - MySQL module for php5
#!/bin/sh
# check if the doord.pid is in the /var/run folder, showing that doord is running okay
cat /var/run/doord.pid
echo " "
# if cat shows up okay, then say we're cool, otherwise start doord again
if [ $? = 0 ] ; then
== AddAttachmentsPhotoToContent: migrating ===================================
-- add_column(:contents, :photo_file_name, :string)
rake aborted!
An error has occurred, all later migrations canceled:
Mysql::Error: Duplicate column name 'photo_file_name': ALTER TABLE `contents` ADD `photo_file_name` varchar(255)