Open ~/.bash_profile
in your favorite editor and add the following content to the bottom.
# Git branch in prompt.
parse_git_branch() {
#!/bin/bash | |
IN=$1 | |
OUT=$2 | |
true ${SD_PARAMS:="-55dB:d=0.3"}; | |
true ${MIN_FRAGMENT_DURATION:="20"}; | |
export MIN_FRAGMENT_DURATION | |
if [ -z "$OUT" ]; then |
class Cache | |
@redis = {} | |
def self.fetch key, expires_in = 30, &block | |
puts "" | |
puts @redis | |
if @redis.key?(key) && (@redis[key][:expiration_time] > Time.now.to_i) | |
# fetch and return result | |
puts "fetch from cache and will expire in #{@redis[key][:expiration_time] - Time.now.to_i}" | |
@redis[key][:value] | |
else |
function html2clipboard(html, el) { | |
var tmpEl; | |
if (typeof el !== "undefined") { | |
// you may want some specific styling for your content - then provide a custom DOM node with classes, inline styles or whatever you want | |
tmpEl = el; | |
} else { | |
// else we'll just create one | |
tmpEl = document.createElement("div"); | |
// since we remove the element immedeately we'd actually not have to style it - but IE 11 prompts us to confirm the clipboard interaction and until you click the confirm button, the element would show. so: still extra stuff for IE, as usual. |
First, let's create the $ subl command | |
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl | |
Another option is to use duti (http://duti.org / https://github.com/moretension/duti). | |
Run brew install duti, save a file like this as ~/.duti: | |
com.sublimetext.3 public.plain-text all | |
com.sublimetext.3 public.unix-executable all |
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb | |
# Maps logical Rails types to MySQL-specific data types. | |
def type_to_sql(type, limit = nil, precision = nil, scale = nil) | |
return super unless type.to_s == 'integer' | |
case limit | |
when 1; 'tinyint' | |
when 2; 'smallint' | |
when 3; 'mediumint' | |
when nil, 4, 11; 'int(11)' # compatibility with MySQL default |
if ($request_uri = /) { | |
set $test A; | |
} | |
if ($host ~* teambox.com) { | |
set $test "${test}B"; | |
} | |
if ($http_cookie !~* "auth_token") { | |
set $test "${test}C"; |
#!/bin/sh | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
TIMEOUT=${TIMEOUT-60} | |
APP_ROOT=/path/to/your/app/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
ENVIRONMENT=production |
server { | |
root /var/www/example.com/static; | |
server_name example.com; | |
access_log /var/log/nginx/example.com.access.log; | |
error_log /var/log/nginx/example.com.error.log; | |
try_files /maintenance.html @proxy; | |
location @proxy { | |
proxy_pass http://127.0.0.1:10001; |