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
-- Opens up terminal tabs and runs commands in them. | |
-- Modify switch_dir and/or tab_commands to taste. | |
-- If you switch away from Terminal.app in the middle | |
-- of the script running, you'll (probably) get an error. | |
-- Based on this script by Matthew Lambie: | |
-- http://lambie.org/2007/11/03/tabs-in-terminal-using-applescript-on-leopard/ | |
-- Modified by James MacAulay 2009-2010 |
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 | |
# call with filenames as arguments | |
# outputs lines which appear in all files | |
# (stripping leading and trailing whitespace, in no predictable order) | |
# $ cat > foo | |
# apple | |
# orange | |
# pear |
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
# git-freeze: take the current index and working tree state and "freeze" them | |
# by creating a commit for each as necessary | |
# | |
# git-thaw: look for commits created by git-freeze and restore them to | |
# working tree or index as appropriate | |
# alias gf='git-freeze' | |
# alias gt='git-thaw' | |
function git-freeze () { |
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
--- codereview | |
+++ (clipboard) | |
@@ -1665,6 +1665,12 @@ | |
vcs.UploadBaseFiles(issue, rpc_server, patches, patchset, options, files) | |
if options.send_mail: | |
rpc_server.Send("/" + issue + "/mail", payload="") | |
+ | |
+ if response_body.startswith("Issue created.") or\ | |
+ response_body.startswith("Issue updated."): | |
+ url = msg[msg.rfind("http"):] |
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
# long-running command growler | |
# hooks for zsh, built on bash version at http://hints.macworld.com/article.php?story=20071009124425468 | |
preexec_functions+='save_preexec_time' | |
save_preexec_time() { | |
export PREEXEC_CMD="$(history $HISTCMD | sed 's/ *[0-9]* *//')" | |
export PREEXEC_TIME=$(date +'%s') | |
} | |
precmd_functions+='growl_about_long_running_commands' |
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
# fixture_label_of_record(shops(:snowdevil)) | |
# => "snowdevil" | |
class ActiveSupport::TestCase | |
def fixture_label_of_record(record) | |
yaml_file = fixture_path + record.class.table_name + '.yml' | |
labels = YAML.load(File.read(yaml_file)).keys | |
labels.find {|l| Fixtures.identify(l) == record[record.class.primary_key]} | |
end | |
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
class Batman.Cons extends Batman.Object | |
@accessor (key) -> | |
return unless key.match(/^c[ad][ad]+r$/) | |
@get("c#{key[1]}r.c#{key[2..key.length-2]}r") | |
@accessor 'car', -> @car | |
@accessor 'cdr', -> @cdr | |
constructor: (@car, @cdr) -> | |
class Batman.Stream extends Batman.Cons | |
@accessor 'cdr', -> @cdrFunction() |
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 JSONMatcher | |
def matches?(request) | |
request.format && request.format.json? | |
end | |
end | |
BatmanPaginator::Application.routes.draw do | |
resources :children | |
resources :components |
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
(ns jasmine.core) | |
(def expect (.-expect js/window)) | |
(.beforeEach js/window (fn [] | |
(this-as spec | |
(.addMatchers spec (js-obj | |
"to_be" #(this-as expectation | |
(= % (.-actual expectation)))))))) |
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
(defmacro iffn | |
"Like `if`, but operates on the level of functions. Returns a function which applies its arguments to `test-fn`. | |
If the return value of `test-fn` is truthy, `then-fn` is called with the same arguments to get the return value. | |
Otherwise, `else-fn` is used. In other words, it lets you rewrite this: | |
#(if (pos? %) (inc %) (dec %)) | |
as this: | |
(iffn pos? inc dec)" |