Skip to content

Instantly share code, notes, and snippets.

@yagihiro
yagihiro / CircularBuffer.h
Created February 18, 2009 09:50
circular buffer library for Arduino (C++)
/*
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:
@satoruhiga
satoruhiga / SimpleKalmanFilter
Last active September 24, 2015 16:38
SimpleKalmanFilter
class SimpleKalmanFilter
{
public:
float xhat, xhatminus;
float P, Pminus;
float _x, _p;
float Q, R, K;
@xjamundx
xjamundx / express-pagination.js
Created April 19, 2011 05:28
sample pagination using express route-specific middleware
// 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);
@bergie
bergie / README.md
Created May 18, 2011 11:33
Falsy Values tutorials
@steeleforge
steeleforge / gist:1035273
Created June 20, 2011 08:00
ExpressJS app.coffee
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
@j4mie
j4mie / example.html
Created July 29, 2011 15:40
A tiny shim for Processing/Coffeescript prototyping
<!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 ->
@satoruhiga
satoruhiga / ofxKdTree.h
Created August 22, 2011 17:14
ofxKdTree
#include "kdtree.h"
template<class T>
class ofxKdTree
{
public:
ofxKdTree()
{
kd = kd_create(3);
@satoruhiga
satoruhiga / ofxRecordableOscReceiver.h
Created September 23, 2011 00:32
ofxRecordableOscReceiver
#pragma once
#include "ofMain.h"
#include "ofxOsc.h"
#define OFX_RECOSC_SAVE_XML
#ifdef OFX_RECOSC_SAVE_XML
#include "ofxXmlSettings.h"
#endif
@satoruhiga
satoruhiga / ofxSimpleParticleSystem.h
Created September 29, 2011 14:06
ofxSimpleParticleSystem
#pragma once
#include "ofMain.h"
#include <tr1/array>
/*
// EXAMPLE
#include "testApp.h"
#include "ofxSimpleParticleSystem.h"