This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "yo momma!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Create a file called trace_sqllog with the following | |
#!/usr/sbin/dtrace -qs | |
pid$1::*dispatch_command*:entry | |
{ | |
printf("%d::%s\n",tid,copyinstr(arg2)); | |
} | |
## Taken from http://blogs.sun.com/angelo/entry/observing_mysql_sql_statements_in | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def select_options_tag(name='',select_options={},options={}) | |
#set selected from value | |
selected = '' | |
unless options[:value].blank? | |
selected = options[:value] | |
options.delete(:value) | |
end | |
select_tag(name,options_for_select(select_options,selected),options) | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By Louis-Philippe Gauthier | |
# http://lpgauth.tumblr.com/post/56451143/reverse-geocoding-google-ruby | |
require 'rubygems' | |
require 'net/http' | |
require 'xmlsimple' | |
def reverse_geocode(lat, lng) | |
url = "http://maps.google.com/maps/geo?ll=#{lat.to_s},#{lng.to_s}&output=xml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EmailsController = MVC.Controller.extend('emails', | |
/* @Static */ | |
{ | |
}, | |
/* @Prototype */ | |
{ | |
load: function(params) { | |
this.render({action: 'email_index', to: "emails"}) | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Web | |
require 'rubygems' | |
require 'open-uri' | |
require 'nokogiri' | |
# @render_options :fields=>{:default=>[:title, :href], | |
# :values=>[:title, :link]} | |
# @options :external=>false | |
# Displays the links from a URL | |
def links_in(url, options={}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wget --user-agent="" -e robots=off --wait 1 -r -l inf -k -nc http://toneway.com/songs | |
filenames = Dir.open('songs').entries.map{|f|"songs/#{f}"} | |
filenames.each{|file| | |
if file.length > 9 | |
File.open("#{file}") { |file| | |
file.each do |l| | |
fname = l.match(/flashvars:"file=(.+)&display/) | |
if fname |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
strings = [] | |
directories = Dir['views/**/*'] | |
directories.each do |d| | |
if d.match(/\.ejs\z/) && !d.match(/help/) | |
File.open(d) { |file| | |
file.each do |l| | |
brackets = l.match(/>([^<]+)</) | |
brackets.captures.each do |m| | |
if m.to_s.length > 5 | |
strings.push(m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p /tmp/chrome-mac | |
cd /tmp/chrome-mac | |
CHROME_VERSION=$(curl http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST) | |
curl http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/$CHROME_VERSION/chrome-mac.zip > chrome-mac.zip | |
osascript <<EOF | |
tell application "Chromium" | |
quit | |
end tell | |
EOF | |
unzip chrome-mac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
# url dsl -- the ultimate url dsl! | |
# | |
# You just can't beat this: | |
# | |
# $ irb -r url_dsl | |
# >> include URLDSL | |
# => Object | |
# >> http://github.com/defunkt.json |
OlderNewer