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/ruby | |
RED = "\033[0;31m" | |
RESET = "\033[0m" | |
YELLOW = "\033[0;33m" | |
BLUE = "\033[0;35m" | |
GREY = "\033[0;34m" | |
trap("INT") { puts; exit! 127 } |
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"?> | |
<scheme name="Colbalt" version="1" parent_scheme="Default"> | |
<option name="LINE_SPACING" value="1.1" /> | |
<option name="EDITOR_FONT_SIZE" value="12" /> | |
<option name="EDITOR_FONT_NAME" value="Monaco" /> | |
<colors> | |
<option name="CARET_COLOR" value="ffffff" /> | |
<option name="CARET_ROW_COLOR" value="133d61" /> | |
<option name="FOLDING_TREE_COLOR" value="466a8a" /> | |
<option name="INDENT_GUIDE" value="123b5f" /> |
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 NSURLRequest (mxcl) | |
+ (id)requestWithURL:(NSURL *)url; | |
+ (id)requestWithURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval; | |
+ (id)requestWithURLString:(NSString *)url; // for convenience | |
@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
#!/usr/bin/ruby | |
# The Ruby FizzBuzz with the best concision versus elegance compromise. | |
# Fork if you have better ideas. | |
1.upto 100 do |n| | |
puts [[:fizz][n%3], [:buzz][n%5]].join[/.+/m] || n | |
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
#define TDURLRegularExpression "(?i)\\b((?:https?://|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?\u00AB\u00BB\u201C\u201D\u2018\u2019]))" |
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 | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |
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
$:.unshift(`brew --prefix`.chomp+'/Library/Homebrew') | |
require 'global' | |
Formula.each do |f| | |
p f | |
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
#Add before any other code in `bin/brew` | |
module Kernel | |
alias_method :old_backtick, :` | |
alias_method :old_system, :system | |
def system *args | |
t = Time.now | |
old_system *args | |
puts "#{Time.now - t}: #{args*' '}" | |
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
#import "MBSQLite.h" | |
#import <sqlite3.h> | |
int sqlite3_exec_callback(void *userdata, int argc, char **argv, char **column) { | |
id aa = (__bridge NSMutableArray *)userdata; | |
while (argc--) | |
[aa insertObject:@(argv[argc]) atIndex:0]; | |
return SQLITE_OK; | |
} |
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
// cc hlink.c -o hlink | |
#include <unistd.h> | |
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 3) | |
return 1; | |
int ret = link(argv[1], argv[2]); |