Skip to content

Instantly share code, notes, and snippets.

traceroute to 130.89.254.233 (130.89.254.233), 64 hops max, 52 byte packets
1 router (192.168.1.1) 2.792 ms 1.361 ms 1.546 ms
2 82-197-205-65.dsl.cambrium.nl (82.197.205.65) 1.875 ms 3.482 ms 1.883 ms
3 fo1-ve395.nikhef.cambrium.net (217.19.16.113) 4.877 ms 5.007 ms 4.980 ms
4 fo1-ve395.nikhef.cambrium.net (217.19.16.113) 4.779 ms 6.927 ms 4.989 ms
5 xsr03.asd002a.surf.net (195.69.144.34) 5.395 ms 5.186 ms 5.370 ms
6 ae1.500.jnr01.asd001a.surf.net (145.145.80.70) 5.415 ms 5.237 ms 5.551 ms
7 utwente-router.customer.surf.net (145.145.4.2) 7.747 ms 7.859 ms 7.658 ms
8 linux059.routing.utwente.nl (130.89.254.233) 7.618 ms 7.545 ms 7.802 ms
class Protocol
constructor: ->
@recvCbs = []
@recvBuffer = new ByteBuffer
@socket = new Socket
@socket.onData = @onData.bind(this)
send: (buf) -> @socket.write(buf)
recv: (n, cb) -> @recvCbs.push({n: n, cb: cb})
class Protocol
constructor: ->
# ..same as previous snippet
@recvCbs.stack = [0] # pointer stack
recv: (n, cb) ->
# insert callback at pointer on stack
@recvCbs.splice(@recvCbs.stack[@recvCbs.stack.length-1], 0, {n: n, cb: cb})
@recvCbs.stack[@recvCbs.stack.length-1]++
@EmielM
EmielM / loading.html
Created September 18, 2011 20:42
Unintrusive img loading indicator
<html>
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0" />
<style>
@-webkit-keyframes spin {from {
-webkit-transform: rotate(0deg)
}
to {
-webkit-transform: rotate(360deg)
struct ZmqWaiter {
zmq::socket_t sleep_socket_;
ZmqWaiter(zmq::context_t& ctx) : sleep_socket_(ctx, ZMQ_PUSH) {}
// Waits for either
// (a) msecs milliseconds to pass
// (b) global zmq_ctx to be teared down
inline bool Sleep(unsigned long msecs) {
try {
zmq::pollitem_t pollitem;
@EmielM
EmielM / uiwebview-tweaks.m
Created May 8, 2014 18:31
UIWebview enhancement hacks
// Continuously changing GIST of UIWebView 'tweaks' I use. Might be useful to others,
// hope Google finds this. Some of these already passed Review, but one never knows ;).
// Happy coding!
- (void)ScrollView_setContentOffset:(CGPoint)offset {
// Prevent superfluous scrolling animations (eg when toggling keyboard) by completely disabling scrolling. We achieve scrolling through inner scroll views (overflowing html elements).
}
- (id)WebBrowserView_inputAccessoryView {
// Make the keyboard accessory view (next/prev,submit buttons) optional, it really takes up to much screen estate in a normal app.
@EmielM
EmielM / rollup.config.js
Created July 27, 2017 12:48
react-native rollup bundle attempt
import fs from 'fs';
import path from 'path';
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript';
import replace from 'rollup-plugin-replace';
function findVersion(file, extensions) {
for (let e of extensions) {