Skip to content

Instantly share code, notes, and snippets.

View deathbob's full-sized avatar

Bob Larrick deathbob

View GitHub Profile
# Make gems available
require 'rubygems'
# http://drnicutilities.rubyforge.org/map_by_method/
begin
require 'map_by_method'
rescue LoadError
puts "map_by_method is not installed. To enable, run: gem install map_by_method"
end
@bradfordcp
bradfordcp / parser.js
Created May 10, 2011 13:38
Converts the json version of the olson timezone database into MySQL tables. Here we have scoped the directories we are searching to certain continents, that logic may be removed in favor of just passing the root directory into process_dir().
#! /usr/bin/env node
// Require the filesystem library
var fs = require('fs');
// Connect to MySQL
var Client = require('mysql').Client, client = new Client();
client.user = 'rails';
client.connect();
client.query('USE scratch');
@brentkirby
brentkirby / i_like_this_but_not_facebook.rb
Created May 18, 2011 19:11
like button helper for bobbers
def facebook_like_button
"<iframe src='http://www.facebook.com/plugins/like.php?href=#{request.url}&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=35' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:450px; height:35px;' allowTransparency='true'></iframe>"
end
@brentkirby
brentkirby / Guardfile
Created June 23, 2011 21:25
Guard + Rspec + Spork
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'rspec', :version => 2,
:cli => '--colour --drb --format documentation --fail-fast',
:all_after_pass => false,
:all_on_start => false,
:keep_failed => false,
:notify => true do
watch(%r{^spec/.+_spec\.rb$})
@chebyte
chebyte / upload_youtube_it.rb
Created June 28, 2011 13:24
upload video with youtube_it from web
#application_controller.rb
class ApplicationController < ActionController::Base
helper_method :yt_client
private
def yt_client
@yt_client ||= YouTubeIt::Client.new(:username => user, :password => password, :dev_key => dev_key)
#you can use the auth method that you want.
end
end
@jimweirich
jimweirich / analysis.rb
Created July 20, 2011 16:37
Results from Roman Numeral Calculator Kata at @cincinnatirb
# When I posted the results of the Roman Numeral Calculator kata
# earlier this week, I said that I felt that the evolution of the code
# through TDD was much more interesting than the final result. Let me
# explain.
#
# First, some background. The goal of this Kata is to produce a
# RomanNumeralCalculator object that converts from arabic numbers to
# Roman numerals, and from Roman numerals back to arabic.
Then { calculate("1").should == "I" }
@jasonrudolph
jasonrudolph / about.md
Last active May 14, 2024 16:36
Programming Achievements: How to Level Up as a Developer

Talks I submitted for Richmond Code Camp 2011.2.

When Not To Follow Best Practices

Too often, software best practices are dictated by others without conveying an understanding of why a particular practice is a good idea. Even worse, these prescriptions don't come with the most critical piece of knowledge: when should you break the rules? A rule that is followed blindly can be worse than no rule at all.

In this talk, we'll remedy this problem. We'll explore several major software development best practices, and walk you through some examples of where they work great. But more importantly, we'll talk about when you shouldn't follow them, and what you might consider doing instead.

To get the most out of this talk, you should be familiar with unit testing and the idea of refactoring, because we'll be proving that we haven't changed the overall behavior of the code during our live demos.

A Friendlier Approach for CSS Color Manipulation

By Chris Eppstein and Michael Parenteau

These ideas build on ones proposed by Tab Atkins but expand the concepts to apply to any color value, not just named colors.

They provide the full power of Sass's color system while preserving a more human-readable system when multiple transformations are applied because the arguments are closer to the operations.

@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active November 9, 2024 08:57
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1