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
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}) |
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
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]++ |
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
<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) |
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
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; |
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
// 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. |
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
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') |
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
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) { |
OlderNewer