Opinions are like assholes, every one has got one.
This one is mine.
Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.
| /** | |
| * Module dependencies. | |
| */ | |
| var pkg = require('../package'); | |
| var env = process.env.NODE_ENV || 'development'; | |
| /** | |
| * Return setting `name`. | |
| * |
| tobi = { name = 'tobi' } | |
| loki = { name = 'loki' } | |
| # equality | |
| same = |a, b| a.name == b.name | |
| print(same(tobi, loki)) | |
| # greeting | |
| greet = |user| 'Hello ' .. user.name |
| function params(fn) { | |
| var str = fn.toString(); | |
| var sig = str.match(/\(([^)]*)\)/)[1]; | |
| if (!sig) return []; | |
| return sig.split(', '); | |
| } | |
| console.api = function(obj){ | |
| console.log(); | |
| var proto = Object.getPrototypeOf(obj); |
| # setup fd 3 as udp connection to drone | |
| exec 3<>/dev/udp/192.168.1.1/5556 | |
| # takeoff | |
| echo -e "AT*REF=1,512\r" >&3 | |
| # landing | |
| echo -e "AT*REF=2,0\r" >&3 | |
| ... | |
| # profit? |
| var cluster = require('cluster'); | |
| var PORT = +process.env.PORT || 1337; | |
| if (cluster.isMaster) { | |
| // In real life, you'd probably use more than just 2 workers, | |
| // and perhaps not put the master and worker in the same file. | |
| cluster.fork(); | |
| cluster.fork(); | |
| cluster.on('disconnect', function(worker) { |
| def greet(first:string, last:string) { | |
| ret "Hello " + first + " " + last | |
| } | |
| // | |
| // Calculating prime factors in polynomial time using node.js process.prevTick() | |
| // | |
| // see: http://en.wikipedia.org/wiki/Prime_factor | |
| // see: http://en.wikipedia.org/wiki/Novikov_self-consistency_principle | |
| // | |
| // Authors: | |
| // http://jesusabdullah.net/ | |
| // http://marak.com | |
| // |
| module.exports = setup; | |
| setup.consumes = ["http"]; | |
| function setup(config, imports, register) { | |
| imports.http.wrap(require('./middleware')(config)); | |
| register(); | |
| } |
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: carbon-cache | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: carbon-cache init script | |
| # Description: An init script for Graphite's carbon-cache daemon. | |
| ### END INIT INFO |