Skip to content

Instantly share code, notes, and snippets.

View kieran's full-sized avatar
📚
40 day free trial!

Kieran Huggins kieran

📚
40 day free trial!
View GitHub Profile
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var filterEmberScript = require('broccoli-ember-script');
var app = new EmberApp({
hinting: false,
name: require('./package.json').name,
minifyCSS: {
class Partition
constructor: (@size,@parent)->
# init our 2d array for this partition
@matrix = new Array @size
for row, idx in @matrix
@matrix[idx] = new Array @size
jobs: 0
drop: (x,y,done)->
@jobs++
# the 26 Dupont bus route in Toronto, Canada
bus_route = CloudMade.path :points=> [[43.66749, -79.39982], [43.66801, -79.39736], [43.66926, -79.3979], [43.67031, -79.39827], [43.67073, -79.39832], [43.6727, -79.39913], [43.67437, -79.39981], [43.67512, -79.39994], [43.67636, -79.4005], [43.67623, -79.40087], [43.6758, -79.40253], [43.67534, -79.40473], [43.67485, -79.40708], [43.67449, -79.40881], [43.67416, -79.40953], [43.67367, -79.4118], [43.67313, -79.41436], [43.67249, -79.4173], [43.67162, -79.42153], [43.67095, -79.42491], [43.67057, -79.42658], [43.6702, -79.42822], [43.67008, -79.42878], [43.67008, -79.42902], [43.67023, -79.42951], [43.67028, -79.42986], [43.66969, -79.43273], [43.66944, -79.43393], [43.66894, -79.43642], [43.66856, -79.43827], [43.66845, -79.43902], [43.66849, -79.43991], [43.66814, -79.44181], [43.6678, -79.44344], [43.66773, -79.4436], [43.66724, -79.44414], [43.66717, -79.44429], [43.66673, -79.44644], [43.66572, -79.45121], [43.66513, -79.45413], [43.66482, -79.45559], [43.664
khug:wmba kieran$ geddy
Server running at port 8000
3 May 14:32:49 - GET: /products
Routed to Products controller, index action
params: { controller: 'Products', action: 'index' }
Finished handling request in 6 ms
3 May 14:32:52 - GET: /
Routed to Main controller, index action
var profiles = {
production: {
logFile: function(){ config.logFile || false },
debug: false,
info: false,
warn: false,
fatal: true
},
development: {
logFile: function(){ config.logFile || false },
var fs = require('fs')
fs.open(file, process.O_WRONLY, 0666, function(err,fd){
if (err) return sys.puts(sys.inspect(err));
fd.write(msgs.join("\n"))
msgs = [];
})
@@ -82,7 +82,9 @@ var Router = function () {
var r = _resourceTypes[i];
this.match('/' + resource + (r.path || '') + '.:extension', r.method).to(
{ controller: controllerName, action: r.action});
- }
+ // no extension, rely on accept headers
+ this.match('/' + resource + (r.path || ''), r.method).to(
+ { controller: controllerName, action: r.action}); }
};
var startServ = function (restart) {
passArgs = restart ? args.concat('-Q', 'true') : args;
child = spawn('node', args);
//..........
sys.puts(sys.inspect(child.pid)) // ** reports pid properly
};
** It should be noted that I'm by no means even remotely competent, especially in JS.
Design goals:
load as little as possible, as infrequently as possible
avoid the overhead of forking a new process for each request
..and having to manage these processes - Merb workers go rogue all the time, which is annoying as hell
take advantage of the already sandboxey nature of v8
clean up the application global namespace a little
protect Geddy's global namespace from getting clobbered
use whatever libraries / core extensions in either Geddy OR the app without fear of conflicts
r.match('/'+cslug+'(.:format)','GET').to({ controller: controller, action: 'index' }),
r.match('/'+cslug+'/add(.:format)','GET').to({ controller: controller, action: 'add' }),
r.match('/'+cslug+'/:id(.:format)','GET').to({ controller: controller, action: 'show' }),
r.match('/'+cslug+'/:id/edit(.:format)','GET').to({ controller: controller, action: 'edit' }),
r.match('/'+cslug,'POST').to({ controller: controller, action: 'create' }),
r.match('/'+cslug+'/:id(.:format)','PUT').to({ controller: controller, action: 'update' }),
r.match('/'+cslug+'/:id','DELETE').to({ controller: controller, action: 'remove' })