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
set -g prefix C-a | |
bind - split-window -v | |
bind-key C-a last-window | |
# Set status bar | |
set -g status-bg black | |
set -g status-fg white | |
set-window-option -g automatic-rename off | |
set-window-option -g mode-keys vi |
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 'active_record' | |
class Grouping < ActiveRecord::Base | |
has_and_belongs_to_many :values | |
has_and_belongs_to_many :characteristics | |
end | |
class Characteristic < ActiveRecord::Base | |
has_and_belongs_to_many :groupings | |
has_many :values, :through => :groupings |
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 'httparty' | |
module Balanced | |
module_function | |
class HTTPError < StandardError | |
attr_reader :response | |
attr_reader :message | |
def initialize(response, message) | |
@response = response |
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
# encoding: utf-8 | |
require 'uri' | |
module URI | |
class Parser | |
def escape2(str, unsafe = @regexp[:UNSAFE]) | |
unless unsafe.kind_of?(Regexp) | |
# perhaps unsafe is String object | |
unsafe = Regexp.new("[#{Regexp.quote(unsafe)}]", false) |
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
" Easily open hyperlinks in any Vim buffer: | |
" Place cursor before or at the beginning of a URL that | |
" begins with http: or https: and press <leader>o | |
let s:http_link_pattern = 'https\?:[^ >)\]]\+' | |
let g:browser_command = 'open ' | |
func! s:find_href() | |
let res = search(s:http_link_pattern, 'cw') | |
if res != 0 | |
let href = matchstr(expand("<cWORD>") , s:http_link_pattern) |
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
Step 1: | |
In the Vagrant VM, we pre-configure git to use our own custom mini commit message editor: | |
git config --global core.editor rbcommit | |
Step 2: | |
We create this small Bash script called `rbcommit`, chmod +x it, and put it on the user's PATH. |
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
" Home-brewed Rails file-finder: | |
" Type :OP followed by a string fragment, and the app,test,spec,lib,config,db | |
" directories will be searched for files that match that string. | |
" Press TAB or shift-TAB to move through matches, and ENTER to open the file | |
" shown. | |
command -complete=custom,FasterOpenFunc -nargs=1 OP call s:faster_open(<f-args>) | |
func! FasterOpenFunc(A,L,P) | |
return system("find app test spec lib config db -name '*".a:A."*' 2>/dev/null | awk -F / '{print $NF \" -> \" $0}'") | |
endfun |
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
{-# LANGUAGE Arrows, NoMonomorphismRestriction #-} | |
module Main where | |
import Text.XML.HXT.Core | |
import System.Environment | |
import Data.List | |
import Control.Arrow.ArrowNavigatableTree | |
import Text.XML.HXT.XPath.Arrows | |
import Data.Tree.NTree.TypeDefs | |
import Data.Tree.NavigatableTree.Class |
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 | |
# deploy.sh | |
# Put this script on your production server and make it executable with chmod | |
# +x. | |
# Set the deploy_dir variable to the path on the production server to | |
# deployment directory. The script assumes the deployment directory is a git | |
# clone of the codebase from an upstream git repo. This script also assumes |
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
set @months := 1; | |
select | |
user_id, | |
group_concat(note_cnt_2 order by date) sparkline | |
from | |
(select user_id, date, coalesce(sum(note_cnt), 0) note_cnt_2 from | |
(select u.user_id, date_series.date, note_cnt from | |
(select id user_id from users) u cross join | |
(select selected_date date from (select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date from | |
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0, |