Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
/* | |
CircularBuffer.h - circular buffer library for Arduino. | |
Copyright (c) 2009 Hiroki Yagita. | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
'Software'), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to |
; Released under the Apache License, Version 2.0 | |
; http://www.apache.org/licenses/LICENSE-2.0.html | |
(defmacro try-let | |
"A combination of try and let such that exceptions thrown in the binding or | |
body can be handled by catch clauses in the body, and all bindings are | |
available to the catch and finally clauses. If an exception is thrown while | |
evaluating a binding value, it and all subsequent binding values will be nil. | |
Example: |
class SimpleKalmanFilter | |
{ | |
public: | |
float xhat, xhatminus; | |
float P, Pminus; | |
float _x, _p; | |
float Q, R, K; | |
// articles per page | |
var limit = 10; | |
// pagination middleware function sets some | |
// local view variables that any view can use | |
function pagination(req, res, next) { | |
var page = parseInt(req.params.page) || 1, | |
num = page * limit; | |
db.articles.count(function(err, total) { | |
res.local("total", total); |
Some exercises from the Falsy Values workshops.
The good parts:
express = require('express') | |
app = module.exports = express.createServer() | |
app.configure -> | |
app.set 'views', __dirname + '/views' | |
app.set 'view engine', 'jade' | |
app.use express.bodyParser() | |
app.use express.methodOverride() | |
app.use app.router |
<!DOCTYPE html> | |
<title>CoffeeScript/Processing</title> | |
<script src="https://raw.github.com/jeresig/processing-js/master/processing.js"></script> | |
<script src="https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js"></script> | |
<script src="https://raw.github.com/gist/1114064/professing.js"></script> | |
<script type="text/coffeescript"> | |
sketch -> |
#include "kdtree.h" | |
template<class T> | |
class ofxKdTree | |
{ | |
public: | |
ofxKdTree() | |
{ | |
kd = kd_create(3); |
#pragma once | |
#include "ofMain.h" | |
#include "ofxOsc.h" | |
#define OFX_RECOSC_SAVE_XML | |
#ifdef OFX_RECOSC_SAVE_XML | |
#include "ofxXmlSettings.h" | |
#endif |
#pragma once | |
#include "ofMain.h" | |
#include <tr1/array> | |
/* | |
// EXAMPLE | |
#include "testApp.h" | |
#include "ofxSimpleParticleSystem.h" |