An extremely minimal implementation of the `Finger protocol`_ using node.js.
To run (Finger uses port 79 which requires sudo):
sudo node finger_server.js
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_deleted { | |
[[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-" | |
} | |
function parse_git_added { | |
[[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+' |
Shoes.app do | |
def answer(message) | |
@results.prepend { para(message) } | |
end | |
limit = 20 | |
magic_number = rand limit | |
tries = 0 | |
para 'guess the number' | |
guess = edit_line |
var ws = require("websocket-server") | |
, router = require("nws-router"); | |
var server = ws.createServer({ | |
debug: true | |
}); | |
server.use(router); |
var query = (function() { | |
var query, engine, engines = ('NW.Dom.select,base2.dom.querySelectorAll,Sizzle,$$,$,jQuery,'+ | |
'YAHOO.util.Selector.query,dojo.query,Ext.DomQuery.select,document.querySelectorAll').split(','); | |
while (engine = engines.shift()) { | |
if (Function('try{ var els = ' + engine + '("*"); return els.length > 0 }catch(e){}')()) { | |
query = Function('cssExpr', 'return ' + engine + '(' + | |
(/^base2/.test(engine) ? 'document,' : '') + 'cssExpr)'); | |
break; | |
} |
// The `quickEach` method will pass a non-unique jQuery instance | |
// to the callback meaning that there will be no need to instantiate | |
// a fresh jQuery instance on each iteration. Most of the slow-down | |
// inherent in jQuery's native iterator method (`each`) is the constant | |
// need to have access to jQuery's methods, and so most developers | |
// see constructing multiple instances as no issue... E.g. | |
// $(...).each(function(){ $(this)... $(this)... $(this)... }); | |
// A better approach would be `quickEach`. | |
jQuery.fn.quickEach = (function(){ |
/*! | |
* Connect - Mongo | |
* Copyright(c) 2010 Vladimir Dronnikov <[email protected]> | |
* MIT Licensed | |
*/ | |
/** | |
* Module dependencies. | |
*/ |
/* PhoneGap-iPhone UIWebView viewport fix */ | |
/** | |
Called when the webview finishes loading. This stops the activity view and closes the imageview | |
*/ | |
- (void)webViewDidFinishLoad:(UIWebView *)theWebView | |
{ | |
/* Fix the viewport to properly fit to the screen */ | |
CGRect windowFrame = [ [ UIScreen mainScreen ] bounds ]; | |
CGRect webViewFrame = [ [ UIScreen mainScreen ] applicationFrame ]; |
An extremely minimal implementation of the `Finger protocol`_ using node.js.
To run (Finger uses port 79 which requires sudo):
sudo node finger_server.js
// More convenient modification of ES5 property descriptors (by @kangax) | |
Object.changeDesc = function(obj, prop, newDesc) { | |
var oldDesc = Object.getOwnPropertyDescriptor(obj, prop); | |
for (var p in newDesc) { | |
if (p === 'get' || p === 'set') { | |
delete oldDesc.value; | |
delete oldDesc.writable; | |
} | |
else if (p === 'value' || p === 'writable') { |
/** | |
* `and` plugins for jQuery | |
* --- | |
* Pretty intuitive. Enables stuff like: | |
* $('a').andChildren(); | |
* Quicker & easier than: | |
* $('a').children().andSelf() | |
*/ | |
(function(){ |