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
function tab () { | |
CURRENT_RVM=$rvm_ruby_string | |
osascript 2>/dev/null <<EOF | |
tell application "System Events" | |
tell process "Terminal" to keystroke "t" using command down | |
end | |
tell application "Terminal" | |
activate | |
do script with command "cd $PWD; rvm $CURRENT_RVM; $*" in window 1 | |
end tell |
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
#!/usr/bin/env python | |
import sys | |
import math | |
import matfunc | |
import idmethod | |
import csv | |
for filename in sys.argv[1:]: | |
wdirlist=[] |
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 'rubygems' | |
require 'sinatra' | |
require 'rack/utils' | |
@@datastore = [] | |
get '/' do | |
if params[:t] | |
@@datastore.unshift(Rack::Utils.unescape(params[:t])) | |
"a" |
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
#!/usr/bin/env ruby | |
# Written by @tamalw for @jasonfried (http://twitter.com/jasonfried/status/1177797820) | |
# Portions of the Twitter class borrowed from @hagus (http://gist.github.com/41922) | |
require 'rubygems' | |
require 'net/http' | |
require 'hpricot' | |
class Twitter | |
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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'net/http' | |
require 'hpricot' | |
class Twitter | |
def initialize(username, password) | |
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
# Models | |
class Agent < ActiveRecord::Base | |
belongs_to :manager | |
belongs_to :site | |
belongs_to :workgroup | |
end | |
class Manager < ActiveRecord::Base | |
has_many :agents |
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 'time' | |
class Time | |
def in(tz) | |
current_tz = ENV["TZ"] | |
ENV["TZ"] = tz | |
new_time = self.getutc.getlocal | |
ENV["TZ"] = current_tz | |
new_time | |
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
#!/bin.bash | |
regex='^[0-9]+$' | |
foo='1234' | |
bar='hi bean' | |
echo "foo = $foo" | |
if [[ "$foo" =~ $regex ]]; then |
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 'date' | |
class DateTime | |
def to_f | |
days_since_unix_epoch = self - ::DateTime.civil(1970) | |
(days_since_unix_epoch * 86_400).to_f | |
end | |
end | |
foo = DateTime.now |
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
# | |
# tweet_beat.rb | |
# ShoesFest 2008 | |
# | |
# Created by Tamal White on 2008-07-25. | |
# Copyright 2008 Tamal White. All rights reserved. | |
# | |
require 'hpricot' |