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
This Gist is defunct (no pun intended). | |
If you use it, please have a look at this version: | |
http://github.com/mkhl/tm-terminal/tree/master |
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 'net/http' | |
require 'uri' | |
# /api/v1/:format/new | |
# /api/v1/:format/gists/:user | |
# /api/v1/:format/:gist_id | |
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'), | |
{ 'files[file1.ab]' => 'CONTNETS', | |
'files[file2.ab]' => 'contents' }) |
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
// A workaround for Javascript's bizarre constructor semantics | |
// Source: http://www.dekorte.com/blog/blog.cgi?do=item&id=3749 | |
Object.clone = function() { | |
var constructor = new Function; | |
constructor.prototype = this; | |
obj = new constructor; | |
obj.init() | |
return obj | |
} | |
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
// Source: http://blog.mbcharbonneau.com/post/56581688/better-logging-in-objective-c | |
#define DebugLog(format, ...) NSLog(@"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(format), ##__VA_ARGS__]) |
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
/Developer/Extras/Xcode\ Index\ Templates/install_templates | |
# Installs into: | |
# ~/Library/Application\ Support/Apple/Developer\ Tools/Index\ Templates | |
# and can be moved to: | |
# /Library/Application\ Support/Apple/Developer\ Tools/Index\ Templates |
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
// from: somewhere around http://briksoftware.com/blog/ | |
int main(int argc, char *argv[]) | |
{ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSWorkspace *env = [NSWorkspace sharedWorkspace]; | |
NSString *app = [env absolutePathForAppBundleWithIdentifier:@"com.pdfkey.pdfkeypro"]; | |
NSString *targetPath = [[app stringByAppendingPathComponent:@"Contents/Resources/pdflock"] retain]; | |
const char *CStringPath = [targetPath UTF8String]; |
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
-Wall | |
-Wextra | |
-Wfloat-equal | |
-Wpointer-arith | |
-Wstrict-prototypes | |
-Wold-style-definition | |
-Wshadow | |
-Wshorten-64-to-32 | |
-Wmissing-prototypes | |
-Wunused-function |
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 'irb' | |
module IRB | |
def self.start_session(binding) | |
IRB.setup(nil) | |
workspace = WorkSpace.new(binding) | |
if @CONF[:SCRIPT] | |
irb = Irb.new(workspace, @CONF[:SCRIPT]) |
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
// GCC Attribute for autoscoped Obj-C objects | |
// Source: http://www.cocoabuilder.com/archive/message/cocoa/2009/3/13/232287 | |
#define autoscoped __attribute__((cleanup(releaseObject))) | |
static inline void releaseObject(id *object) | |
{ | |
[*object release]; | |
} | |
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
Constant := Object clone do ( | |
with := method(msg, | |
self msg := msg | |
self activate := method(call message setName(msg asString); msg) | |
) | |
) | |
// Lets try it out: | |
// Make PI a regular number | |