Skip to content

Instantly share code, notes, and snippets.

@EmielM
EmielM / rollup.config.js
Created Jul 27, 2017
react-native rollup bundle attempt
View rollup.config.js
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) {
View semi-anonymous-chat.diff
diff --git a/client.coffee b/client.coffee
index 37b7239..a5eb7b9 100644
--- a/client.coffee
+++ b/client.coffee
@@ -49,7 +49,10 @@ exports.render = !->
Dom.div !->
Dom.cls 'chat-info'
- Dom.text tr("Anonymous coward")
+ if userId = msg.get('userId')
@EmielM
EmielM / uiwebview-tweaks.m
Created May 8, 2014
UIWebview enhancement hacks
View uiwebview-tweaks.m
// 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.
View gist:1901791
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 / loading.html
Created Sep 18, 2011
Unintrusive img loading indicator
View loading.html
<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)
View protocol-machine-02.coffee
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]++
View protocol-machine-01.coffee
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})
View traceroute 130.89.254.233
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
@EmielM
EmielM / schema.xml
Created Dec 16, 2010
Mondrian cube schema
View schema.xml
<Schema name="TestSchema">
<Cube name="TestCube" caption="Caption" cache="false" enabled="true">
<Table name="SolarData"></Table>
<Dimension type="StandardDimension" name="Time">
<Hierarchy hasAll="true">
<Level name="Year" column="time" type="String" uniqueMembers="true">
<KeyExpression><SQL dialect="generic"><![CDATA[extract(year from time)]]></SQL></KeyExpression>
<NameExpression><SQL dialect="generic"><![CDATA[extract(year from time)]]></SQL></NameExpression>
</Level>
<Level name="Month" column="time" type="String" uniqueMembers="false">
View compile-error
$ i686-apple-darwin9-g++ -c test.mm -o test.o -I/home/emiel/mac/include 2>&1 | head -n30
In file included from /home/emiel/mac/include/boost/asio/socket_base.hpp:26,
from /home/emiel/mac/include/boost/asio/basic_socket.hpp:26,
from /home/emiel/mac/include/boost/asio/basic_datagram_socket.hpp:25,
from /home/emiel/mac/include/boost/asio.hpp:20,
from test.mm:2:
/home/emiel/mac/include/boost/asio/detail/socket_option.hpp:78: error: using template type parameter 'Protocol' after 'struct'
/home/emiel/mac/include/boost/asio/detail/socket_option.hpp:85: error: using template type parameter 'Protocol' after 'struct'
/home/emiel/mac/include/boost/asio/detail/socket_option.hpp:92: error: using template type parameter 'Protocol' after 'struct'
/home/emiel/mac/include/boost/asio/detail/socket_option.hpp:99: error: using template type parameter 'Protocol' after 'struct'
You can’t perform that action at this time.