Skip to content

Instantly share code, notes, and snippets.

View washu's full-sized avatar

Sal Scotto washu

  • Colorado Springs, CO
View GitHub Profile
@washu
washu / README.md
Created May 13, 2024 14:28 — forked from palkan/README.md
ActionCable over SSE

Action Cable over SSE

This is a demo of leveraging the proposed Action Cable architecture to implement an SSE transport for Action Cable (without changing the user-space code, e.g., Connection and Channel classes).

Start the server by running the following command:

 ruby main.rb

Now, you can connect to Action Cable over SSE via cURL as follows:

require 'redis'
# the heart of the message bus, it acts as 2 things
#
# 1. A channel multiplexer
# 2. Backlog storage per-multiplexed channel.
#
# ids are all sequencially increasing numbers starting at 0
#
class MessageBus::Message < Struct.new(:global_id, :message_id, :channel , :data)
@washu
washu / Repos.elm
Created July 28, 2017 16:27 — forked from turboMaCk/Repos.elm
Use ! infix function in update
module Repos exposing (main)
import List
import Html exposing (..)
import Html.App
import Html.Attributes exposing (..)
import Html.Events as Events
import Http
import Json.Decode as Json exposing ((:=))
import Task exposing (..)
@washu
washu / Architecture.md
Created July 28, 2017 16:02 — forked from evancz/Architecture.md
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
/*jshint bitwise: false*/
(function (global, document, undefined) {
'use strict';
//*
if (Object.assign == null || Object.assign == 'undefined') {
Object.assign = function (target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
# Message Bus Web Worker Implmentation.
# Performs the polling in a web worker.
# Input Messages
# start (options same as message bus)
# stop
# pause
# resume
# subscribe
# unsubscribe
# publish (hard coded to /_ap/ endpoint) sends a message to a backend channel via the worker.
From a010f0e13be5b1e791c92d9708dff8d5a8d45de4 Mon Sep 17 00:00:00 2001
From: Eugene Kenny <elkenny@gmail.com>
Date: Sun, 8 Jan 2017 02:13:36 +0000
Subject: [PATCH] forwardable/impl.rb: include trace instruction
---
ext/rubyvm/lib/forwardable/impl.rb | 1 -
1 file changed, 1 deletion(-)
diff --git a/ext/rubyvm/lib/forwardable/impl.rb b/ext/rubyvm/lib/forwardable/impl.rb
From a010f0e13be5b1e791c92d9708dff8d5a8d45de4 Mon Sep 17 00:00:00 2001
From: Eugene Kenny <elkenny@gmail.com>
Date: Sun, 8 Jan 2017 02:13:36 +0000
Subject: [PATCH] forwardable/impl.rb: include trace instruction
---
ext/rubyvm/lib/forwardable/impl.rb | 1 -
1 file changed, 1 deletion(-)
diff --git a/ext/rubyvm/lib/forwardable/impl.rb b/ext/rubyvm/lib/forwardable/impl.rb
From a010f0e13be5b1e791c92d9708dff8d5a8d45de4 Mon Sep 17 00:00:00 2001
From: Eugene Kenny <elkenny@gmail.com>
Date: Sun, 8 Jan 2017 02:13:36 +0000
Subject: [PATCH] forwardable/impl.rb: include trace instruction
---
ext/rubyvm/lib/forwardable/impl.rb | 1 -
1 file changed, 1 deletion(-)
diff --git a/ext/rubyvm/lib/forwardable/impl.rb b/ext/rubyvm/lib/forwardable/impl.rb
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<script type="text/javascript">window.NREUM||(NREUM={});NREUM.info={"beacon":"bam.nr-data.net","errorBeacon":"bam.nr-data.net","licenseKey":"c5ea8cbb08","applicationID":"3433522","transactionName":"dFheEEdWXl9SEEtQF0NWUwxYXFxHRE0XWQxA","queueTime":0,"applicationTime":83,"agent":""}</script>
<script type="text/javascript">(window.NREUM||(NREUM={})).loader_config={xpid:"VQUEVFFTGwAEV1JXBQM="};window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var o=e[n]={exports:{}};t[n][0].call(o.exports,function(e){var o=t[n][1][e];return r(o||e)},o,o.exports)}return e[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,e,n){function r(t){try{c.console&&console.log(t)}catch(e){}}var o,i=t("ee"),a=t(12),c={};try{o=localStorage.getItem("__nr_flags").split(","),console&&"function"==typeof console.log&&(c.console