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
| var keypress = require('keypress') | |
| , tty = require('tty'); | |
| // make `process.stdin` begin emitting "keypress" events | |
| keypress(process.stdin); | |
| // listen for the "keypress" event | |
| process.stdin.on('keypress', function (ch, key) { | |
| console.log('got "keypress"', key.name); | |
| if (key && key.ctrl && key.name == 'c') { |
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
| var hex = (Math.random()*0xFFFFFF<<0).toString(16);; |
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
| try: | |
| import lxml.html | |
| def striphtml(data): | |
| t = lxml.html.fromstring(data) | |
| return t.text_content() | |
| except: | |
| import re | |
| def striphtml(data): | |
| t = re.compile(r'<.*?>') | |
| return t.sub('', data) |
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
| find . -name ".svn" -exec rm -rf {} \; |
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
| console.log(process.stdout.getWindowSize()); |
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
| MessageList = Backbone.Collection.extend({ | |
| initialize: function(models, options) { | |
| options = options || {}; | |
| this.offset = options.offset || 0; | |
| this.limit = options.limit || 30; | |
| this.sortBy = options.sortBy || 'by_desc'; | |
| }, | |
| url: 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
| "#"+((1<<24)*Math.random()|0).toString(16) |
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
| svn export file:///path/ . --force |
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
| NSAlert *alert = [[NSAlert alloc] init]; | |
| [alert setAlertStyle:NSInformationalAlertStyle]; | |
| [alert setMessageText:@"Message text"]; | |
| [alert setInformativeText:@"Info text"]; | |
| [alert runModal]; |
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
| NSMutableArray *arr = [[NSMutableArray alloc]init]; | |
| for(int i=0;i<=10;i++) { | |
| NSString *nm=[NSString stringWithFormat:@"Raju %d",i]; | |
| [arr addObject:nm]; | |
| } | |
| NSLog(@"%lu", [arr count]); |