Skip to content

Instantly share code, notes, and snippets.

View shimaore's full-sized avatar
🏕️

Stéphane Alnet shimaore

🏕️
View GitHub Profile
@shimaore
shimaore / express_3.diff
Created June 5, 2012 22:07
express_3 first draft
diff --git a/package.json b/package.json
index 3d90697..665b891 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"homepage": "http://zappajs.github.com/zappajs/",
"repository": {"type": "git", "url": "git://github.com/zappajs/zappajs.git"},
"dependencies": {
- "express": "2.5.9",
+ "express": "3.0.x",
@@ -280,10 +280,38 @@ zappa.app = (func,disable_io,require_css) ->
if typeof arguments[0] isnt 'object'
render.apply @, arguments
else
for k, v of arguments[0]
render.apply @, [k, v]
+ include: (paths) ->
+
+ _end = res.end
+ _write = res.write
@shimaore
shimaore / noclobber-proper.diff
Created September 20, 2011 07:42
Setting 'noclobber' allows @ to contain the data while the zappa context is passed as an argument. Setting 'dataparam' keeps @ as the context while the data is passed as an argument.
diff -ru mauricemach-zappa-ac57545//src/zappa.coffee zappa-noclobber//src/zappa.coffee
--- mauricemach-zappa-ac57545//src/zappa.coffee 2011-09-17 03:12:51.000000000 +0200
+++ zappa-noclobber//src/zappa.coffee 2011-09-20 10:42:15.000000000 +0200
@@ -285,12 +285,19 @@
names = []
names.push k for k, v of ctx
+ data = [req.query, req.params, req.body]
+
if app.settings['autoimport']
@shimaore
shimaore / explained.coffee
Created September 9, 2011 00:49
(proof-of-concept) Zappa with runInContext() to provide glocal vars
zappa =
run: (f)->
# Re-compile the function in a context that contains the Zappa
# methods as globals.
vm = require 'vm'
code = 'zappa_code='+f.toString()
views = {}
router = {}
@shimaore
shimaore / gist:1046898
Created June 25, 2011 21:06
Fix for node.couchapp.js issue #15
diff --git a/main.js b/main.js
index fa8466f..221ed8b 100644
--- a/main.js
+++ b/main.js
@@ -8,8 +8,6 @@ var path = require('path')
, spawn = require('child_process').spawn
;
-var h = {'content-type':'application/json', 'accept-type':'application/json'}
-
@shimaore
shimaore / zappa-express.diff
Created June 16, 2011 13:14
Zappa diff to implement #25
diff -rub -x .git zappa-github//src/zappa.coffee zappa/src/zappa.coffee
--- zappa-github//src/zappa.coffee 2011-06-16 15:12:35.000000000 +0200
+++ zappa/src/zappa.coffee 2011-05-16 20:33:06.000000000 +0200
@@ -15,7 +15,7 @@
@current_app = null
@locals =
- app: (name) => @app name
+ app: (name,server) => @app name, server
include: (path) => @include path
@shimaore
shimaore / couchapp+auth.patch
Created February 23, 2011 14:46
A simple patch to add one argument (the Base64-encoded value of the "Basic" authorization HTTP header) to node.couchapp.js.
diff --git a/bin.js b/bin.js
index 21a4f35..4a7c8ae 100755
--- a/bin.js
+++ b/bin.js
@@ -14,6 +14,7 @@ var node = process.argv.shift()
, command = process.argv.shift()
, app = process.argv.shift()
, couch = process.argv.shift()
+ , auth = process.argv.shift()
;
class Zappa
constructor: ->
...
@locals =
app: (name,server) => @app name,server
...
app: (name,server) ->
@ensure_app name,server
@current_app = @apps[name]