THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
#!/usr/bin/env bash | |
# Usage: setup-git-bundler-merge-driver | |
# Help: Configures git to use a custom merge driver to resolve Gemfile.lock | |
# merge conflicts. | |
if [ ! -f Gemfile ]; then | |
echo 'No `Gemfile` found! Aborting' | |
exit 1 | |
fi |
-- The MySQL docs say COALESCE() "returns the first non-NULL value in the list, | |
-- or NULL if there are no non-NULL values." This turns out not to be true. | |
-- If the value to be returned is an integer, COALESCE() first casts it to | |
-- the type of a subsequent non-NULL argument. ಠ_ಠ | |
mysql> SELECT 0 = '', | |
-> COALESCE(0, '') = '', | |
-> COALESCE(0, ''), | |
-> COALESCE(0, NULL), | |
-> COALESCE(0, 98.6, NULL), |
class Question < ActiveRecord::Base | |
# UGLY | |
def self.starts_with(*strings) | |
# Big loop to build something like this... | |
where("wording LIKE ? OR wording LIKE ? OR wording LIKE ?", 'blah%', 'blaah%', 'blaaah%') | |
end | |
# PURDY | |
def self.starts_with(*strings) | |
strings = strings.map { |s| s+'%' } |
Copy, with line wrapping!
If you've been trying to copy/paste text from a multi-pane tmux
session with the mouse, you've probably been pretty pissed at the blissful ignorance a terminal application has of the rodent in your hand.
The alternative, which is quote-unqoute native copy/pasting using copy-mode takes a bit to get used to. So this is one solution for copying and pasting lines from a session with correct line wrapping behaviour, albeit keyboard only.
Disclaimer
Since copy-mode has similar concepts of marks, regions, and temp buffers to Emacs .. you'll probably find it straight forward if you're familar with Emacsen. For people using vi-mode in tmux
, the same still applies but obviously the default key bindings will differ alot from what I show below.
digraph models_diagram { | |
graph[overlap=false, splines=true] | |
"Venue" [shape=record, label="{\ | |
Venue|name :string\l\ | |
}"] | |
"User" [shape=record, label="{User|\ | |
email :string\l\ | |
password :string\l\ | |
}"] |
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence | |
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users | |
if exists('$TMUX') | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif |
# vim: ft=sh:ts=4:sw=4:autoindent:expandtab: | |
# Author: Avishai Ish-Shalom <[email protected]> | |
# We need to specify GNU sed for OS X, BSDs, etc. | |
if [[ "$(uname -s)" == "Darwin" ]]; then | |
SED=gsed | |
else | |
SED=sed | |
fi |