As configured in my dotfiles.
start new:
tmux
start new with session name:
require 'optparse' | |
ENV['RAILS_ENV'] = ENV['RAILS_ENV'] || 'development' | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | |
opts = {} | |
ARGV.options {|opt| | |
opt.on('-s', '--save', 'save') {|v| opts[:save] = v } | |
opt.parse! |
/** | |
* $.parseParams - parse query string paramaters into an object. | |
*/ | |
(function($) { | |
var re = /([^&=]+)=?([^&]*)/g; | |
var decodeRE = /\+/g; // Regex for replacing addition symbol with a space | |
var decode = function (str) {return decodeURIComponent( str.replace(decodeRE, " ") );}; | |
$.parseParams = function(query) { | |
var params = {}, e; | |
while ( e = re.exec(query) ) { |
upstream tunnel { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
server_name dev.codeplane.com br.dev.codeplane.com; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; |
include Rails.application.routes.url_helpers | |
default_url_options[:host] = "localhost" |
As configured in my dotfiles.
start new:
tmux
start new with session name:
# Here's a contrived example of a LEFT JOIN using ARel. This is an example of | |
# the mechanics, not a real-world use case. | |
# NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord | |
# extension that works for any named association. That's what I really wanted! | |
# Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446 | |
# == DEFINITIONS | |
# - A Taxi is a car for hire. A taxi has_many :passengers. | |
# - A Passenger records one person riding in one taxi one time. It belongs_to :taxi. |
select fund_sums.total, fund_products.name | |
from ( | |
select sum(allocation_amount) total, fund_product_id | |
from transactions | |
where transactions.investor_id = 490 | |
group by fund_product_id | |
) fund_sums | |
left join fund_products on fund_sums.fund_product_id = fund_products.id |
function! s:dict(...) | |
let is_macunix = has('mac') || has('macunix') || has('gui_macvim') || (!executable('xdg-open') && system('uname') =~? '^darwin') | |
if(!is_macunix) | |
echohl WarningMsg | |
echomsg 'Your platform is not supported!' | |
echohl None | |
finish | |
endif | |
let word = len(a:000) == 0 ? input('Dictionary search: ', expand('<cword>')) : join(a:000, ' ') | |
call system(printf("open dict://'%s'", word)) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000