Skip to content

Instantly share code, notes, and snippets.

@trvrplk
trvrplk / Button
Created August 11, 2011 14:50
A button script in ColdFusion
<INPUT TYPE="Reset" NAME="ComtrolName" VALUE="DisplayName">
@trvrplk
trvrplk / Gemfile
Created November 17, 2012 17:46
Smallest Gemfile i've seen
source :rubygems;['sqlite3','json','jquery-rails'].each {|gem| gem "#{gem}"};group :assets do;gem 'sass-rails';gem 'coffee-rails';gem 'uglifier';end;gem "rails", "3.2.9"
user system total real
Excon 0.050000 0.030000 0.080000 ( 5.392849)
Typhoeus 0.040000 0.010000 0.050000 ( 2.189296)
Typhoeus::Hydra 0.040000 0.010000 0.050000 ( 3.153995)
Net::HTTP 0.050000 0.030000 0.080000 ( 2.503522)
Curb 0.030000 0.040000 0.070000 ( 4.071390)
@trvrplk
trvrplk / gist:4397604
Last active December 10, 2015 06:58
Example of the Decorator pattern.
class Drink
def name
"Drink"
end
def ingredients
%w()
end
end
@trvrplk
trvrplk / license
Last active December 10, 2015 08:48 — forked from defunkt/license
Apache License
#!/bin/sh -e
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > COPYING
#!/bin/sh
echo "Copyright (c) `date +%Y` weddingcakes
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

weddingcakes' Style Guide

All Languages

  • Indent with 2 spaces and expandtab on (With exceptions like Java).

Ruby

  • Use underscores in long method names, like this:

weddingcakes' Style Guide

All Languages

  • Indent with 2 spaces and expandtab on (With exceptions like Java).

Ruby

  • Use underscores in long method names, like this:

weddingcakes' Style Guide

All Languages

  • Indent with 2 spaces and expandtab on (With exceptions like Java).

Ruby

  • Use underscores in long method names, like this:
@trvrplk
trvrplk / craigslist.rb
Created January 25, 2013 22:02
Script to get the newest free stuff
#! /usr/bin/env ruby
require "nokogiri"
require "open-uri"
subject = Nokogiri::HTML(open("http://#{ARGV[0]}.craigslist.org/zip/"))
subject.css('#toc_rows a').each do |listing|
puts "#{listing.content}"
end
date = Time.now.yday
if date < 359
a = 359 - date
puts "#{a}"
elsif date == 360
a = date - -1
puts "#{a}"
elsif date == 361
a = date - -2
puts "#{a}"