Skip to content

Instantly share code, notes, and snippets.

View orderthruchaos's full-sized avatar

Brett DiFrischia orderthruchaos

View GitHub Profile
defmodule GCM.PushCollector do
use GenStage
# Client
def push(pid, push_requests) do
GenServer.cast(pid, {:push, push_requests})
end
# Server
defmodule GCM.Pusher do
use GenStage
# The maximum number of requests Firebase allows at once per XMPP connection
@max_demand 100
defstruct [
:producer,
:producer_from,
:fcm_conn_pid,
:pending_requests,
@orderthruchaos
orderthruchaos / grove_led_bar_with_rotary_controller.ino
Created October 5, 2016 20:56
Concatenation of files for the Grove LED bar controller with the Bean+ project.
/* This is a concatenation of the following files from
https://github.com/Seeed-Studio/Grove_LED_Bar (LGPL):
- Grove_LED_Bar.h
- Grove_LED_Bar.cpp (less the #include for the above header)
and the code from
https://www.hackster.io/karel/grove-led-bar-controller-with-the-bean-c3b81e
(less the #include for the above header) with corrections from the
comments. */
@orderthruchaos
orderthruchaos / install_phoenix.sh
Created February 22, 2016 21:15 — forked from ulve/install_phoenix.sh
Install Erlang/Elixir/Phoenix on a Raspberry Pi
#!/bin/bash
sudo apt-get update
sudo apt-get --assume-yes install wget
sudo apt-get --assume-yes install libssl-dev
sudo apt-get --assume-yes install ncurses-dev
sudo apt-get --assume-yes install m4
# erlang
wget http://erlang.org/download/otp_src_18.2.tar.gz
tar -xvzf otp_src_18.2.tar.gz
cd otp_src_18.2
@orderthruchaos
orderthruchaos / IEx.exs
Last active November 28, 2019 12:44
A possible q/0 helper for Elixir.IEx.
if ! Enum.member?(:erlang.loaded, IEx.UserDrv.Config) do
defmodule IEx.UserDrv.Config do
import Process, only: [group_leader: 0]
@moduledoc """
Structure to hold :user_drv configuration information.
"""
defstruct node: Node.self, pid: nil, port: nil, leader: group_leader

City Construction Site

Get it? Site? oh man.

Demos for GreenSock's latest 18.0 release, with stagger cycle and hsl tweens, as well as jQuery3.0 with class operations on SVG. So many goodies. SVG.

A Pen by Sarah Drasner on CodePen.

License.

@orderthruchaos
orderthruchaos / bnd_utils.clj
Created September 10, 2015 23:37
Implementation of `def-` for Clojure
(ns bnd-utils)
; Based on the definition of defn-
(defmacro def-
"same as def, yielding non-public def"
[name & decls]
(let [m (assoc (meta name) :private true)]
`(do
(def ~name ~@decls)
(alter-meta! (var ~name) assoc :private true))
@orderthruchaos
orderthruchaos / smile_amazon_com.user.js
Created April 7, 2015 15:03
Greasemonkey User Script: ensure that you are on smile.amazon.com.
// ==UserScript==
// @name smile_amazon_com
// @namespace http://orderthruchaos.bitbucket.org/
// @copyright 2015+, Brett DiFrischia
// @license
// @description Always remember to smile!
// @grant GM_log
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @include http://www.amazon.com/*
// @include https://www.amazon.com/*
@orderthruchaos
orderthruchaos / hex_pm_hexdocs_link.user.js
Created April 7, 2015 15:01
Greasemonkey User Script: add hexdoc.pm link to hex.pm package information page.
@orderthruchaos
orderthruchaos / rand_sig.m
Created March 31, 2015 15:53
MATLAB function to create randomized list of 2 values.
function [ sigmas ] = rand_sig( s1, s2, p, n )
% RAND_SIG Generate random list of sigmas
% sigs = rand_sig(0.5, 0.45, 0.65, 100000);
%
% Arguments:
% s1 = first standard deviation
% s2 = second standard deviation
% p = probability (decimal) of s1 occurring
% n = number of items to generate