This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <math.h> | |
| #include <stdlib.h> | |
| #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) | |
| #include <windows.h> | |
| #endif | |
| #include <GL/gl.h> | |
| #include <GL/glu.h> | |
| #include <GL/glut.h> | |
| #include <stdio.h> | |
| const int screenWidth = 600; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct foo { | |
| static int bar; | |
| int baz; | |
| foo():baz(bar){} | |
| foo(int woof):baz(woof){} | |
| }; | |
| int foo::bar = 3; | |
| int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // multiple vars | |
| var fs = require('fs'); | |
| var net = require('net'); | |
| // no whitespace after function name | |
| // no whitespace after `(` and before `)`, like real text | |
| // whitespace before block scope, open in the same line | |
| // camelCase function names | |
| function foo(bar, baz) { | |
| // ident with 2 spaces |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| struct Alma { | |
| Alma& foo() { return *this; } | |
| virtual void bar() { printf("alma"); } | |
| }; | |
| struct Belma: public Alma { | |
| void bar() { printf("belma"); } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mock = require('my-awesome-mock-module')(beforeEach, afterEach); | |
| describe('foo', function() { | |
| var fn = mock(foo, 'bar', [] /* default return value */, true /* async */); | |
| // foo.bar = function(a, b, c) { c(null, []); } | |
| // override in beforeEach hook, restore original in afterEach | |
| it('should qux', function() { | |
| fn([1]); // foo.bar now returns [1] (node async style) | |
| fn(new Error()); // foo.bar now fails | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var amqp = require('amqp'); | |
| var conn = amqp.createConnection(); | |
| conn.once('ready', function() { | |
| console.log('conn ready'); | |
| conn.queue('queue', function(q) { | |
| console.log('queue open'); | |
| q.subscribe(function(message) { | |
| console.log(message); | |
| whoops; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \left( 2\frac{(p_i-p_{i+1})}{(t_{i+1}-t_i)^3}+\frac{\frac{\frac{p_{i+2}-p_{i+1}}{t_{i+2}-t_{i+1}}+\frac{p_{i+1}-p_i}{t_{i+1}-t_i}}{2}(1-\tau)+\frac{\frac{p_{i+1}-p_i}{t_{i+1}-t_i}+\frac{p_i-p_{i-1}}{t_i-t_{i-1}}}{2}(1-\tau)}{(t_{i+1}-t_i)^2} \right )(t-t_i)^3+\left(\frac{3(p_{i+1}-p_i)}{(t_{i+1}-t_i)^2}-\frac{\frac{\frac{p_{i+2}-p_{i+1}}{t_{i+2}-t_{i+1}}+\frac{p_{i+1}-p_i}{t_{i+1}-t_i}}{2}(1-\tau)+(1-\tau)2\frac{\frac{p_{i+1}-p_i}{t_{i+1}-t_i}+\frac{p_i-p_{i-1}}{t_i-t_{i-1}}}{2}}{t_{i+1}-t_i} \right )(t-t_i)^2+\frac{\frac{p_{i+1}-p_i}{t_{i+1}-t_{i}}+\frac{p_i-p_{i-1}}{t_i-t_{i-1}}}{2}(t-t_i)(1-\tau)+p_i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| r_i(t)=r_i+(t-t_i)\frac{\frac{r_{i+1}-r_i}{t_{i+1}-t_{i}}+\frac{r_i-r_{i-1}}{t_i-t_{i-1}}}{2}+(t-t_i)^2\left(\frac{3(r_{i+1}-r_i)}{(t_{i+1}-t_i)^2}-\frac{\frac{\frac{r_{i+2}-r_{i+1}}{t_{i+2}-t_{i+1}}+\frac{r_{i+1}-r_i}{t_{i+1}-t_i}}{2}+2\frac{\frac{r_{i+1}-r_i}{t_{i+1}-t_i}+\frac{r_i-r_{i-1}}{t_i-t_{i-1}}}{2}}{t_{i+1}-t_i} \right )+(t-t_i)^3\left( 2\frac{(r_i-r_{i+1})}{(t_{i+1}-t_i)^3}+\frac{\frac{\frac{r_{i+2}-r_{i+1}}{t_{i+2}-t_{i+1}}+\frac{r_{i+1}-r_i}{t_{i+1}-t_i}}{2}+\frac{\frac{r_{i+1}-r_i}{t_{i+1}-t_i}+\frac{r_i-r_{i-1}}{t_i-t_{i-1}}}{2}}{(t_{i+1}-t_i)^2} \right ) | |
| r_i(t)=r_i+(t-t_i)\frac{\frac{-r_{i}}{t_{i+1}-t_i}+\frac{r_i}{t_i-t_{i-1}}}{4}+(t-t_i)^2\left(\frac{3(-r_i)}{(t_{i+1}-t_i)^2}-\frac{\frac{\frac{-r_i}{t_{i+1}-t_i}}{4}+2\frac{\frac{-r_i}{t_{i+1}-t_i}+\frac{r_i}{t_i-t_{i-1}}}{4}}{t_{i+1}-t_i} \right )+(t-t_i)^3\left( 2\frac{(r_i)}{(t_{i+1}-t_i)^3}+\frac{\frac{\frac{-r_i}{t_{i+1}-t_i}}{4}+\frac{\frac{-r_i}{t_{i+1}-t_i}+\frac{r_i}{t_i-t_{i-1}}}{4}}{(t_{i+1}-t_i)^2} \right ) | |
| r_i+(t-t_i)\frac{\fr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function indent(n) { return Array(n+1).join(' '); } | |
| function elem(name, wrap) { | |
| var before = wrap === false ? | |
| function() {} : function(n) { | |
| console.log(indent(n) + '<' + name + '>'); | |
| }; | |
| var after = wrap === false ? | |
| function() {} : function(n) { | |
| console.log(indent(n) + '</' + name + '>'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Maybe(value) { | |
| this.value = value; | |
| } | |
| Maybe.prototype.map = function _map(fn, ctx) { | |
| ctx = ctx || {}; | |
| return this.value === null ? new Maybe(this.value) : new Maybe(fn.call(ctx, this.value)); | |
| }; | |
| function Either(left, right) { |