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
| #!/bin/env python | |
| """mergelog | |
| This is a custom merge driver for git. It should be called from git | |
| with a stanza in .git.config like this: | |
| [merge "mergelog"] | |
| name = A custom merge driver for my log.txt file. | |
| driver = ~/scripts/mergelog %O %A %B %L | |
| recursive = binary |
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
| In [1]: class Foo: | |
| ...: def __init__(self,x): | |
| ...: self._x = x | |
| ...: def getx(self): | |
| ...: return self._x | |
| ...: x = property(getx) | |
| ...: | |
| ...: | |
| In [2]: f = Foo(5) |
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
| text = open('unknownEndings.txt','rU').read() | |
| open('localEndings.txt','w').write(content) | |
| lines = open('unknownEndings.txt','rU').readlines() | |
| open('localEndings.txt','w').writelines(lines) |
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
| self._window.connect("key-press-event",self._key_press_event) | |
| def _key_press_event(self,widget,event): | |
| keyval = event.keyval | |
| keyval_name = gtk.gdk.keyval_name(keyval) | |
| state = event.state | |
| ctrl = (state & gtk.gdk.CONTROL_MASK) | |
| if ctrl and keyval_name == 's': | |
| self._notewindow.save() | |
| elif ctrl and keyval_name == 'l': |
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 markdown | |
| md = markdown.Markdown(output_format='html4',extensions=['extra',]) | |
| def cb_preformat(args): | |
| if args['parser'] == 'markdown': | |
| html = md.convert(''.join(args['story'])) | |
| md.reset() | |
| return html |
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 markdown | |
| md = markdown.Markdown(output_format='html4',extensions=['extra',]) | |
| def cb_postformat(args): | |
| entry_data = args['entry_data'] | |
| entry_data['body'] = md.convert(''.join(entry_data['body'])) | |
| md.reset() |
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
| +(CCScene *) scene | |
| { | |
| CCScene *scene = [CCScene node]; // scene is autorelease | |
| LookAtMeSetting *setting = [[[LookAtMeSetting alloc] initWithBackground:@"sky.png" terrain:@"grass.png"] autorelease]; | |
| [scene addChild: setting]; | |
| return scene; | |
| } |
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
| CGRect convertRectToWorldSpace(CCNode *node, CGRect rect) | |
| { | |
| CGPoint globalOrigin = [node.parent convertToWorldSpace:rect.origin]; | |
| CGRect globalRect = CGRectMake(globalOrigin.x, globalOrigin.y, rect.size.width, rect.size.height); | |
| return globalRect; | |
| } |
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
| @interface MyClass : NSObject { | |
| @private | |
| BOOL myarray[32][24]; | |
| } | |
| @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
| <!-- Import jQuery. --> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></script> | |
| <script type="text/javascript"> | |
| function fetchAndPrintPosts(id,num,tag) | |
| { | |
| // Read data from Tumblr, this creates the variable tumblr_api_read. | |
| jQuery.ajax({ | |
| type: "GET", | |
| url : "http://staff.tumblr.com/api/read/json?num=" + num + "&filter=text&tagged=" + tag, |