Skip to content

Instantly share code, notes, and snippets.

body {
white-space: pre;
font-family: monospace;
background: #1D1D1D;
color: #FFFFFF
}
body li, body div {
border: 1px solid transparent;
}
@slant
slant / application_controller.rb
Created January 11, 2013 22:52
Best code EVAR!
def state_from_lat_lng(from_lat, from_lng)
State.where(:abbreviation => "TX")
end
@slant
slant / redis_store.rb
Created January 10, 2013 20:38
Add this in `/config/initializers/redis_store.rb` to get RedisStore's sessions working with `domain: :all`
require 'action_dispatch/middleware/session/redis_store'
ActionDispatch::Session::RedisStore.class_eval do
def set_cookie(env, session_id, cookie)
request = ActionDispatch::Request.new(env)
request.cookie_jar[key] = cookie
end
end
@slant
slant / deploy.rb
Created December 27, 2012 23:59
Capistrano task for outputting the last release date and time in human readable format
# Usage:
# $ cap last_release
# Thu, Dec 27, 2012 at 9:47am +0000
task :last_release do
puts DateTime.parse(latest_release.split('/')[-1]).strftime('%a, %b %d, %Y at %l:%M%P %z').squeeze(' ')
end
@slant
slant / twilight.css
Created December 8, 2012 01:54
Custom Twilight theme for JSONView
body {
white-space: pre;
font-family: monospace;
background: #1D1D1D;
color: #FFFFFF;
}
body li, body div {
border: 1px solid transparent;
}
@slant
slant / Custom.css
Created December 8, 2012 01:44
Google Chrome Inspector Solarized Theme
/**********************************************/
/*
/* Solarized Dark Skin by François Robichet - 2012
/*
/* Based on Solarized Dark Skin by Mark Osborne:
/* https://gist.github.com/1245727
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@slant
slant / aprompt.png
Created December 8, 2012 01:42 — forked from mislav/aprompt.png
My zsh prompt. No oh-my-zsh needed
aprompt.png
@slant
slant / gist:4237980
Created December 8, 2012 01:07
Bookmarklet for adding all approval-pending members to a Facebook group (from the See All page)
javascript:var buttons=document.getElementsByClassName('uiButtonText');var add_buttons=new Array;for(var b=0;b<buttons.length;b++){if(buttons[b].innerText=='Add'){add_buttons.push(buttons[b])}};for(var b=0;b<add_buttons.length;b++){add_buttons[b].click()};
class Person
attr_accessor :name
def initialize(name)
@name = name
end
def love(subject, duration)
"#{self} #{__method__} #{subject} #{duration}"
end
@slant
slant / .irbrc
Created May 31, 2012 21:24 — forked from jwaldrip/.irbrc
Keep your irb console history, save this to your home dir.
require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline",
"--prompt-mode",
"simple" ]
# 1500 entries in the list
IRB.conf[:SAVE_HISTORY] = 1500