This file contains 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
public class App { | |
public interface A { | |
B foo(); | |
} | |
public static class B { | |
B foo() { return null; } | |
} | |
public static class C implements A { | |
private int x; | |
public void baz(B b) {} |
This file contains 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 udp = require('dgram'); | |
var server = udp.createSocket('udp4'); | |
var client = null; | |
server.on('message', function(msg, rinfo) { | |
if(rinfo.address = '127.0.0.1') { | |
client = rinfo; | |
} else { | |
server.send(msg, 0, msg.length, client.port, client.address); | |
} | |
var offset = 12, |
This file contains 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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => General | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Sets how many lines of history VIM has to remember | |
set history=700 | |
" modeline magic! | |
set modeline | |
" required! |
This file contains 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
# screen-like prefix | |
unbind C-b | |
set -g prefix C-a | |
# Indexing from 1 instead of 0 | |
set -g base-index 1 | |
set -g pane-base-index 1 | |
# Reload config | |
bind r source-file ~/.tmux.conf \; display "Reloaded tmux config file." |
This file contains 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) { |
This file contains 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 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 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 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 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 | |
}); |