Skip to content

Instantly share code, notes, and snippets.

1 tbsp olive oil 15 mL
1 small onion
3 cloves garlic, minced
1 tsp chili powder 5 mL
1 tsp ground cumin 5 mL
1 1/3 cups ketchup 325 mL
2/3 cup dr. pepper 150 mL
1/4 cup soy sauce 60 mL
1/4 cup cider vinegar 60 mL
1 drop liquid smoke
MBP:~ ed$ ruby -e 'while line = gets; puts line.split; end' <~/Desktop/generated_query.sql | grep JOIN | wc -l
15
MBP:~ ed$ gem install launchy
MBP:~ ed$ launchy http://www.amazon.com/Great-Gonzos-Best-Ted-Nugent/dp/B00001X599
# RED="\[\033[0;31m\]"
# YELLOW="\[\033[0;33m\]"
# GREEN="\[\033[0;32m\]"
# PS1="$RED\$(date +%H:%M) \w$YELLOW \$(parse_git_branch)$GREEN\$ "
function __git_dirty {
git diff --quiet HEAD &>/dev/null
[ $? == 1 ] && echo "!"
}
#!/usr/bin/env ruby
# github + launchy = gaunchy
# open your current repo (+ path) in your browser
# $ gaunchy.rb app/models
require 'rubygems'
require 'git'
require 'launchy'
g = Git.open('.')
wget http://www.five-ten-sg.com/libpst/packages/libpst-0.6.34.tar.gz
cd libpst-0.6.34
./configure
make
make test
make install
readpst -o ~/contacts ~/MS.pst
Opening PST file and indexes...
pg_dump -Uuser db | gzip > filename.gz
scp host:~/filename.gz .
psql -U postgres
drop database db;create database db;
\quit
gunzip filename.gz
psql db < filename
@alkema
alkema / sms-via-enail.rb
Created September 17, 2010 13:38
sms-via-email.rb
class MobileProvider < ActiveRecord::Base
validates_uniqueness_of :name
end
class Mobile < ActiveRecord::Base
include ActionView::Helpers::NumberHelper
belongs_to :user
belongs_to :mobile_provider
before_validation :strip_non_numeric
jody@jodys-macbook-pro-2 ~/code/benefic (master) $ git pull
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
From github.com:domain7/benefic
e58ffce..fa0dd49 master -> origin/master
Updating e58ffce..fa0dd49
Fast-forward
.../_client_organization_contact.html.erb | 10 +++++-----
@alkema
alkema / js-geolocation-to-geocoded-formatted-address.js
Created March 15, 2011 19:16
grab lat + lng from js, geocode and then fill in input as formatted address
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
var geocoder = new google.maps.Geocoder();
function success(position) {
var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
geocoder.geocode({'latLng' : latlng}, function(results, status){
$('#saddr').val(results[0].formatted_address);
});
}
@alkema
alkema / letter-press-on-heroku.rb
Created April 9, 2011 21:10
letter-press-on-heroku
routes
map.connect "/images/letterpress/:letterpress.png", :controller => 'pages', :action => 'letterpress'
controller
def letterpress
send_file "tmp/letterpress/#{params[:letterpress]}.png", :disposition => 'inline'
end