Skip to content

Instantly share code, notes, and snippets.

View chrisbloom7's full-sized avatar
💭
I may be slow to respond.

Chris Bloom chrisbloom7

💭
I may be slow to respond.
View GitHub Profile
@chrisbloom7
chrisbloom7 / There is something to be learned from a rainstorm.
Created August 20, 2008 11:25
One of the quotes featured in the movie Ghost Dog
There is something to be learned from a rainstorm.
When meeting with a sudden shower, you try
not to get wet and run quickly along the road.
By doing such things as passing under the eaves
of houses, you still get wet. When you are
resolved from the beginning, you will not be
perplexed, though you will still get the same
soaking. This understanding extends to all things.
Ghost Dog, Chapter 22, T01:32:25 (quoted from: Hagakure: The Book of the Samauri)
task :write => :environment do
dir = RAILS_ROOT + '/db/backup'
FileUtils.mkdir_p(dir)
FileUtils.chdir(dir)
interesting_tables.each do |tbl|
sql ||= ActiveRecord::Base.connection()
if (records = sql.execute("SELECT * FROM " + tbl) rescue false)
puts "Writing #{tbl}..."
.ilb {
display: -moz-inline-box;
display: inline-block;
}
@chrisbloom7
chrisbloom7 / bookmarklet_to_calculate_the_sum_of_selected_numbers_in_a_table.js
Created February 3, 2010 20:28
Bookmarklet to calculate the sum of selected numbers in a table
javascript:void(prompt('Result',function(){var a=window.getSelection().toString();if(a.indexOf("\n")>=0){a=a.split("\n");var b=0;for(var i=0;i<a.length;i++){b+=parseFloat(a[i])}}else b=parseFloat(a);return(isNaN(b))?0:b}()));
@chrisbloom7
chrisbloom7 / the_hardest_thing_for_me_to_grok_in_ruby.rb
Created March 11, 2010 16:09
The hardest thing for me to grok in Ruby
colors = ["red"] #=> ["red"]
colors_2 = colors #=> ["red"]
colors_2 << "blue" #=> ["red", "blue"]
colors #=> ["red", "blue"]
def add_white (original_colors)
original_colors << "white"
end
add_white colors #=> ["red", "blue", "white"]
macosx:~ chrisb$ irb -rosx/cocoa
/opt/local/lib/ruby/1.8/osx/foundation.rb:8:in `require': no such file to load -- rubycocoa (LoadError)
from /opt/local/lib/ruby/1.8/osx/foundation.rb:8
from /opt/local/lib/ruby/1.8/osx/cocoa.rb:8:in `require'
from /opt/local/lib/ruby/1.8/osx/cocoa.rb:8
from /opt/local/lib/ruby/1.8/irb/init.rb:254:in `require'
from /opt/local/lib/ruby/1.8/irb/init.rb:254:in `load_modules'
from /opt/local/lib/ruby/1.8/irb/init.rb:252:in `each'
from /opt/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
from /opt/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
.mouse{
position: absolute;
background-image: url('../images/cursor.png');
width: 15px;
height: 22px;
z-index: 100;
}
@chrisbloom7
chrisbloom7 / textmate_command_for_php_beautifier.sh
Created July 29, 2010 17:33
Textmate command for PHP_Beautifier
# Runs PHP_Beautifier on the current document.
# See http://beautifyphp.sourceforge.net/ for more info.
# Add this as a new command in TextMate
# I used the following additional command settings:
# Save: Nothing
# Input: Document ("Selected Text or", note PHP_Beautifier
# only works on complete PHP documents)
# Output: Replace Document
if [[ "$TM_SOFT_TABS" == "YES" ]]; then
host-3:co-op chrisbloom7$ node server.js
Error: addListener only takes instances of Function
at Server.addListener (events:55:11)
at new Server (http:524:8)
at new Server (/Users/chrisbloom7/Projects/Test/node.js/co-op/lib/ws.js:50:13)
I'd like to commission some low-res, high-level design ideas from you. Something the represents what you have in mind for the project, but it doesn't have to be a production-ready design (watermarks, copyright, etc. are OK as long as they aren't distracting) . I will pay you US$200 for your time regardless of whether your idea is selected. Feel free to submit more than one idea if you would like. Again, I'm only asking for ideas, not complete designs.
Once I have all of the ideas, I will run all of them by my client and he will choose the one he likes the most. If your idea is selected, I will hire you at a rate of US$1000 for the project (50% up front and the remainder on sign-off). For that price I will expect you to work with me over the next 4 weeks to tweak and finalize the over-all design for the site as well as help me organize information for each of the pages (about 13 pages total) and create a nice visual presentation. The client will be providing most of the copy text; you will be provide the con