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
tell application "Safari" | |
activate | |
do JavaScript "window.location.reload();" in first document | |
end tell | |
tell application "MacVim" to activate |
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 | |
# Add this script to your ~/bin (ensure in $PATH) and chmod +x. | |
# Requires xdotool. | |
# | |
# Add this to your vimrc: | |
# " reload chrome on html/css/js save | |
# au BufWritePost *.{html,css,js} silent !reload-chrome.sh | |
CUR=$(xdotool getwindowfocus) | |
WID=$(xdotool search --onlyvisible --class "google-chrome" | sort -n | head -1) |
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/base" | |
require "sinatra/async" | |
require "redis" | |
module CometTest | |
class App < Sinatra::Base | |
register Sinatra::Async | |
puts ">> #{REDIS = Redis.new(:thread_safe => true)}" |
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
// inject jquery | |
var head = document.getElementsByTagName("head")[0]; | |
var newScript = document.createElement('script'); | |
newScript.type = 'text/javascript'; | |
newScript.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'; | |
newScript.onload = function() { head.removeChild(newScript); modifyDom() }; | |
head.appendChild(newScript); |
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 tries | |
@tries ||= 1 | |
(@tries += 1) - 1 | |
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
# Extracted this code out that was not needed. | |
# Keeping here for future reference. | |
# | |
# Finds upcoming expiry dates for monthly equity options. | |
# | |
# Test data is the official CBOE expiration calendars for 2010/11. | |
require 'date' | |
require 'rubygems' |
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
# bootstrap a new rails 3.0 project from the 3-0-stable branch | |
# | |
# mkdir new_project | |
# | |
# place this Gemfile in new_project | |
# | |
# bundle install --path .gems | |
# bundle exec rails -v | |
# bundle exec rails new . | |
# |
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
/* Returns probability of occuring below and above target price. */ | |
function probability(price, target, days, volatility) { | |
var p = price; | |
var q = target; | |
var t = days / 365; | |
var v = volatility; | |
var vt = v*Math.sqrt(t); | |
var lnpq = Math.log(q/p); |
NewerOlder