Skip to content

Instantly share code, notes, and snippets.

View unplugandplay's full-sized avatar
💫

unplugandplay unplugandplay

💫
View GitHub Profile
@unplugandplay
unplugandplay / msqq.rb
Last active May 15, 2019 13:39 — forked from peterc/msqq.rb
Sys V message queues in Ruby on OS X (take one)
# Lightweight library to access the System V message queue functionality on Mac OS X (32 and 64 bit)
# Still quite scrappy and needs to be packaged up properly but.. it works!
# Tested on 2.6.3
require 'fiddle'
class MsgQ
LIBC = Fiddle.dlopen('libc.dylib')
IPC_CREAT = 001000
@unplugandplay
unplugandplay / glow
Created April 19, 2019 09:30
simplest ever SSE streaming written in crystal
# glow.cr
# simplest ever SSE streaming
# you can test it with the following bash command
# curl http://127.0.0.1:8888
#
require "http/server"
server = HTTP::Server.new do |context|
context.response.content_type = "text/event-stream"
@unplugandplay
unplugandplay / particules
Last active April 19, 2019 07:53
When amber and imba collid in harmony to generate server side event (SSE)
-- imba part:
tag App
def build
messages
def messages
console.log('messages')
@last_event_id = "0"