Skip to content

Instantly share code, notes, and snippets.

View imanel's full-sized avatar

Bernard Potocki imanel

View GitHub Profile

Keybase proof

I hereby claim:

  • I am imanel on github.
  • I am imanel (https://keybase.io/imanel) on keybase.
  • I have a public key ASDNBjeRdxhvbrsg0xHoMT3s_CBrk-KFJwnzzDpRdgF9BAo

To claim this, I am signing this object:

@imanel
imanel / gist:1253674
Created September 30, 2011 13:01
Directly sending message using Socky Server
channel = Socky::Server::Channel.find_or_create('my_app', 'my_channel_name')
message = Socky::Server::Message.new({
'event' => 'my_event',
'channel' => 'my_channel_name',
'data' => { 'my data' => 'some data' }
})
channel.deliver(nil, message)
@imanel
imanel / http_parser.rb - 3 times
Created June 5, 2011 19:19
Thin benchmark results
request concurrency req/s failures
==========================================
1000 1 4028 0
1000 11 6362 0
1000 21 6448 0
1000 31 6349 0
1000 41 6351 0
1000 51 6282 0
1000 61 7141 0
1000 71 6157 0
@imanel
imanel / draft05.md
Created June 1, 2011 10:23
EM-WebSocket: differences from specification

Handshake

Sent data:

GET /chat HTTP/1.1
Host: server.example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==

Sec-WebSocket-Origin: http://example.com

@imanel
imanel / index(production).html
Created April 22, 2011 08:57
New templating system idea
<!-- Some JS loading JSON from /users/index.json and put it to #users via jTemplates -->
<div id="users">
</div>
<script type="text/javascript" id="Templates">
{#template USERS}
<div class="user">
<p>{$T.name}</p>
<p>{$T.email}</p>
# gem install fast_xor
module EventMachine
module WebSocket
class MaskedString < String
def read_mask
raise "Too short" if bytesize < 4 # TODO - change
@masking_key = String.new(self[0..3])
end
def full_mask(start, length)
some: args
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script>
$(document).ready(function(){
function debug(str){ $("#debug").append("<p>" + str); };
ws = new WebSocket("ws://localhost:8080/");
ws.onmessage = function(evt) { $("#msg").append("<p>"+evt.data+"</p>"); };
ws.onclose = function() { debug("socket closed"); };
Dr. House: it is not lupus
robzon: hi guys
marekk: no push server?
Bug: Those bugs everywhere :(
marekk: he he
niko: hey!?
robzon: where did it go..?
niko: «is there anybody out there?»
robzon: aww it's off
filiptepper: Hello, World!