This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
# 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 |
#! /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'); |
def facebook_like_button | |
"<iframe src='http://www.facebook.com/plugins/like.php?href=#{request.url}&layout=standard&show_faces=false&width=450&action=like&font=arial&colorscheme=light&height=35' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:450px; height:35px;' allowTransparency='true'></iframe>" | |
end |
# 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$}) |
#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 |
# 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" } |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
Talks I submitted for Richmond Code Camp 2011.2.
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.
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.
#!/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 |