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
| #import <Cocoa/Cocoa.h> | |
| @interface NSMutableArray (variadicMethodExample) | |
| - (void) appendObjects:(id) firstObject, ...; // This method takes a nil-terminated list of objects. | |
| @end | |
| @implementation NSMutableArray (variadicMethodExample) |
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 mailserver smtp.gmail.com port 587 | |
| username "email@domain.tld" password "password" | |
| using tlsv1 | |
| with timeout 30 seconds |
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
| parse_git_branch() { | |
| RSLT='' | |
| GIT_BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/^* //'` | |
| if [ "$GIT_BRANCH" ] | |
| then | |
| GIT_STATUS=`git status 2> /dev/null | grep 'working directory clean'` | |
| CLR='2' | |
| if [ "$GIT_STATUS" ] | |
| then | |
| CLR='2' |
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
| JAVA_OPTS="${JAVA_OPTS} -Xms1024m -Xmx2048m -XX:MaxPermSize=256m -server"; export JAVA_OPTS; |
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
| ditto -ck --rsrc --keepParent myFolder myFolder.zip |
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
| #!/usr/bin/env ruby | |
| puts "looking for the gems to upgrade..." | |
| gem_info = Struct.new(:name, :version) | |
| to_reinstall = [] | |
| Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path| | |
| path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/ | |
| name, version = $1, $2 | |
| bundle_info = `file path` | |
| to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/ | |
| end |
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 'rubygems' | |
| require 'patron' | |
| require 'json' | |
| COUCH = Patron::Session.new | |
| COUCH.timeout = 120 | |
| COUCH.base_url = "http://localhost:5984" | |
| COUCH.headers['User-Agent'] = 'ruby/mattetti' | |
| AMOUNT_RECORDS = 8000 | |
| $COUCH_ID = 0 |
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
| sed -n "s/^\([^0-9].*\)$/\1 /g" *.srt |
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
| NSObject *scroller = [webView.subviews objectAtIndex:0]; | |
| [scroller performSelector:@selector(setScrollingEnabled:) withObject:NO]; |
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
| # Monitor HTTP requests being made from your machine with a one-liner.. | |
| # Replace "en1" below with your network interface's name (usually en0 or en1) | |
| sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*" | |
| # OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile: | |
| # (again replace "en1" with correct network interface name) | |
| alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"" | |
| # All the above tested only on OS X. |