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 express=require('express'), | |
hogan=require('hogan.js'), | |
adapter=require('./hogan-express.js'), | |
app = express.createServer(); | |
app.configure(function(){ | |
app.use(express.static(__dirname + '/public')); | |
app.use(express.logger()); | |
app.use(express.bodyParser()); | |
app.use(express.cookieParser()); |
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 sum=function(list) { | |
var len=list.length, | |
sum=0, | |
i=0; | |
for(;i<len;i+=1) { | |
sum+=list[i]; | |
} | |
return sum; | |
} |
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 product=function(list) { | |
var len=list.length, | |
sum=1, | |
i=0; | |
for(;i<len;i+=1) { | |
sum=sum*list[i]; | |
} | |
return sum; | |
} |
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
/** | |
* Walk through a list, running an associative function on each item, and returning the result | |
* @param {function} func A function in the form of f(x,y) to be applied to each item and its successor in list | |
* @param {Object[]} list The array to have the function applied to | |
* @param The y value of an object passed into <tt>func</tt> when x is the last item in the list | |
* @returns An object containing the result of <tt>func</tt> applied to <tt>list</tt> | |
*/ | |
var reduce=function(func,list,nilval) { | |
var len=list.length, | |
i=0, |
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
function map(func, list) | |
{ | |
var i=0, | |
len=list.length, | |
res=[]; | |
for (; i < len; i+=1) | |
{ | |
res[i]=func(list[i]); | |
} |
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'), | |
q = require('querystring') | |
http.createServer(function (req, res) { | |
//create the geo long/lat path | |
var url=["/maps/geo?q=" | |
,q.parse(req.url)["long"] | |
,"," | |
,q.parse(req.url)["lat"] |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net.Sockets; | |
using System.Data; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net.Sockets; | |
using System.Data; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Reactive.Linq; |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net.Sockets; | |
using System.Data; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Reactive.Linq; |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net.Sockets; | |
using System.Data; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Reactive.Linq; |