This file contains 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
rebase_prep() { | |
git checkout master && git pull && git checkout - | |
} |
This file contains 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
[alias] | |
rebaseprep = !sh -c 'git checkout master && git pull && git checkout -' |
This file contains 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
<VirtualHost *:80> | |
ServerName sinatra.yourserver.com | |
ServerAlias sinatra.yourserver.com | |
DocumentRoot /home/your_app_user/webapp/current | |
RewriteEngine On | |
<Proxy balancer://thinservers> | |
BalancerMember http://127.0.0.1:5000 | |
BalancerMember http://127.0.0.1:5001 |
This file contains 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
// jquery plugin boilerplate | |
// this plugin has methods and manages separate settings for each instance | |
$.myPluginDefaults = { | |
imageContainer: '.ir_img_container', | |
imageUrls: [] | |
}; | |
$.fn.myPlugin = function( method ) { | |
var inArgs = arguments; |
This file contains 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
__from_ssh_config() { | |
SSHCONFIG=$HOME/.ssh/config | |
COMPREPLY=() | |
local cur=${COMP_WORDS[COMP_CWORD]} | |
COMPREPLY=($(compgen -W '$(cat ~/.ssh/config | grep Host | cut -d" " -f2-)' -- $cur)) | |
} | |
complete -F __from_ssh_config -o default ssh |
This file contains 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
jasmine.Spec.prototype.execute = function(onComplete) { | |
var spec = this; | |
var descs = []; | |
var suite = this.suite; | |
while (suite) { | |
descs.push(suite.description); | |
suite = suite.parentSuite; | |
} | |
descs = descs.reverse(); | |
descs.push(this.description) |
This file contains 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 | |
require 'data_mapper' | |
require 'sinatra' | |
require 'sinatra/config_file' | |
disable :run | |
root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
Dir[File.join(root,"{lib,models}/**/*.rb")].each do |file| | |
require file | |
end |
This file contains 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
var jasmine = jasmine || {} | |
jasmine.getEvents = function(sel, event_name) { | |
var events = []; | |
try { | |
var evs = $$(sel)[0].getStorage().get('prototype_event_registry'); | |
events = evs.get(event_name); | |
} | |
catch(e) {} | |
return events; | |
}; |
This file contains 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
class QueryStringParser | |
constructor: (url) -> | |
@query_params = {} | |
if !document || !document.createElement | |
throw 'This needs to be run in an HTML context with a document.' | |
parser = document.createElement('a') | |
parser.href = url | |
@url = url | |
if (parser.origin) | |
@origin = parser.origin |
This file contains 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 upto(arr,v); arr[0..arr.select{|x| x < v}.count] end | |
# usage | |
arr = 5.times.map{|x| 12 * (2**x)} | |
maxval = 26 | |
upto(arr,maxval) | |
# => [12,24,48] |