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
var http = require('http'); | |
var nerve = exports; | |
nerve.serve = function(app, port, host) { | |
function send_html(content, status_code) { | |
this.sendHeader(status_code || 200, {"Content-Type":"text/html","Content-Length":content.length}); | |
this.sendBody(content); | |
this.finish(); | |
} |
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
var http = require('http'); | |
// example usage: | |
// | |
// require('./nerve'); | |
// | |
// nerve([ | |
// [/^\/hello\/(.*)$/, function(req, res, name) { | |
// res.send_html('Hello, ' + name + '!'); | |
// }] |
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
var http = require('http'); | |
// example usage: | |
// | |
// var nerve = require('./nerve'); | |
// | |
// nerve.create_app( | |
// [ | |
// [/^\/hello\/(.*)$/, function(req, res, name) { | |
// res.send_html('Hello, ' + name + '!'); |
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
// this returns undefined, not the object that follows the return | |
return | |
{ | |
foo: "bar" | |
}; |
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
/*global require, process */ | |
(function() { | |
var http = require('http'), posix = require('posix'), url = require('url'), cache = {}, mime_types = {}; | |
function extname(path) { | |
var index = path.lastIndexOf('.'); | |
if (index < 0) { | |
return; | |
} | |
return path.slice(index + 1); |
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
var sys = require("sys"), | |
http = require("http"); | |
data = '/'; | |
url = 'www.google.com'; | |
url = 'www.neeraj.name' | |
var con = http.createClient(80, url); |
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
from google.appengine.ext import db | |
from google.appengine.ext import webapp | |
from google.appengine.ext.webapp.util import run_wsgi_app | |
import random | |
class SimpleCounterShard(db.Model): | |
count = db.IntegerProperty(required=True, default=0) | |
NUM_SHARDS = 10 |
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
var http = require('http'), | |
sys = require('sys'), | |
couchdb = require('./lib/couchdb'), | |
port = process.env.PORT || 8001, | |
COUCH_PORT = 5984, | |
COUCH_SERVER = 'localhost', | |
COUCH_USER = null, | |
COUCH_PASSWORD = null; | |
function getCounter(callback) { |
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
- (void) perform { | |
UIViewController* source = self.sourceViewController; | |
[UIView transitionWithView:source.navigationController.view duration:0.5f options:UIViewAnimationOptionTransitionFlipFromRight animations:^{ | |
[source.navigationController setViewControllers:@[self.destinationViewController] animated:NO]; | |
} completion:nil]; | |
} |
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
- (id) initWithCoder:(NSCoder*) coder { | |
if (self = [super initWithCoder:coder]) { | |
self.backgroundView = [self createBackgroundViewWithBackgroundColor:[UIColor clearColor]]; | |
self.selectedBackgroundView = [self createBackgroundViewWithBackgroundColor:[UIColor colorWithWhite:57.0f/255.0f alpha:1.0f]]; | |
} | |
return self; | |
} | |
- (UIView*) createBackgroundViewWithBackgroundColor:(UIColor*) backgroundColor { | |
UIView* backgroundView = [[UIView alloc] initWithFrame:self.bounds]; |
OlderNewer