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
module Kernel | |
def min(*args) | |
[*args].sort.first | |
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
module Kernel | |
def min(*args) | |
[*args].inject {|a,b| a = a < b ? a : b} | |
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
function extract { | |
echo Extracting $1 ... | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) rar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; |
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
history 1000 | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head |
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
#!/bin/sh | |
# Send the file to our running Emacs and bring it to the foreground. | |
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient "${1}" \ | |
2> /dev/null \ | |
&& open -a Emacs | |
# If that failed, then open a new emacs visiting the file. | |
if [ $? -ne 0 ]; then | |
EOPEN_DIR="${PWD}" EOPEN_FILE="${1}" open -a Emacs |
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
#!/bin/sh | |
# Send the file to our running Emacs and bring it to the foreground. | |
~/tools/emacs/bin/emacsclient "${1}" \ | |
2> /dev/null \ | |
# If that failed, then open a new emacs visiting the file. | |
if [ $? -ne 0 ]; then | |
dir=sed "/s/\/cygdrive\//g/" ${PWD} 2> /dev/null | |
EOPEN_DIR="${dir}" EOPEN_FILE="${1}" ~/tools/emacs/bin/runemacs.exe |
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
#import <Foundation/Foundation.h> | |
@interface NSString(Extensions) | |
-(NSString *) sha1Hash; | |
@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
require 'utils' | |
class UpdateAll | |
def run | |
display("Updating homebrew and all installed packages, also cleaning up old packages:") | |
safe_system("brew update && brew upgrade && brew cleanup") | |
end | |
def display(message, &block) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>emacs-daemon</string> | |
<key>RunAtLoad</key> | |
<true/> |
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
public static void WhenNotNullPerform<TType, TResult>(this IEnumerable<TType> items, Func<TType, TResult> conditionToCheck, Action<TResult> actionToApply) where TResult : class | |
{ | |
items.Each(x => | |
{ | |
var result = conditionToCheck.Invoke(x); | |
if (result != null) | |
{ | |
actionToApply.Invoke(result); | |
} | |
}); |
OlderNewer