Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@technoweenie
technoweenie / gist:2155760
Created March 22, 2012 04:03
track meta data with resque jobs, like when it was queued.
module Resque
def push_with_meta(queue, item)
if item.respond_to?(:[]=)
item[:meta] = {:queued_at => Time.now.to_f}
end
push_without_meta(queue, item)
end
class Job
# Returns a Hash of the meta data related to this Job.
@marcel
marcel / gist:2100703
Created March 19, 2012 07:24
giftube – Generates an animated gif from a YouTube url.
#!/usr/bin/env ruby
# giftube – Generates an animated gif from a YouTube url.
#
# Usage:
#
# giftube [youtube url] [minute:second] [duration]
#
# ex.
#
@potatosalad
potatosalad / project-web-reload.conf
Created February 11, 2012 03:32
Upstart + Bluepill + Unicorn with hot restart
# /etc/init/project-web-reload.conf
pre-start script
initctl restart project-web
sleep 15
end script
exec /usr/local/rvm/bin/default_bluepill restart
@javan
javan / emoji.m
Created January 10, 2012 02:42
Campfire Emoji
sDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
// People
@":smile:", @"\ue415",
@":blush:", @"\ue056",
@":smiley:", @"\ue057",
@":relaxed:", @"\ue414",
@":smirk:", @"\ue402",
@":heart_eyes:", @"\ue106",
@":kissing_heart:", @"\ue418",
@lenary
lenary / gitconfig.ini
Created February 18, 2011 01:21
a special excerpt of my gitconfig
$ git clone github:lenary/guides.git
Cloning into guides...
remote: Counting objects: 255, done.
remote: Compressing objects: 100% (216/216), done.
remote: Total 255 (delta 111), reused 163 (delta 35)
Receiving objects: 100% (255/255), 1.49 MiB | 564 KiB/s, done.
Resolving deltas: 100% (111/111), done.
$ cd guides
$ git remote -v
@mojombo
mojombo / vwilight.vim
Created January 26, 2011 03:23
vwilight.vim: A TRUE Twilight color theme for Vim
" Vim color file
" Converted from Textmate theme Twilight using Coloration v0.2.5 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@adelcambre
adelcambre / README.txt
Created January 20, 2011 21:43
make messages containing *green* green and containing *red* red in Propane
curl https://gist.github.com/raw/788740/4b337df4be4be4338e2466ef775cd685b57d9601/gistfile1.diff | patch -p0
#!/usr/bin/env ruby
require 'highline/system_extensions'
include HighLine::SystemExtensions
module Standup
module Control
extend self
def play
@quirkey
quirkey / lol
Created September 3, 2010 01:07
#!/usr/bin/env ruby
require 'open-uri'
category = ARGV[0] || 'fail'
url = "http://api.cheezburger.com/xml/category/#{category}/lol/random"
open(url) do |f|
xml = f.read
if xml =~ /LolImageUrl\>([^\<]*)/m
@tmm1
tmm1 / gist:504342
Created August 2, 2010 08:37
rails3 patch for perftools.rb cpu/object profiling
diff --git a/Gemfile b/Gemfile
index fd90d42..9dd0146 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,4 +1,6 @@
source 'http://rubygems.org'
+gem 'perftools.rb', '>= 0.4.4'
+gem 'rack-perftools_profiler'
gem 'rails', '3.0.0.rc'