Skip to content

Instantly share code, notes, and snippets.


Sebastian Porto sporto

View GitHub Profile
mgold /
Last active Mar 24, 2020
Using Mailboxes in Elm: a tutorial blog post

Using Mailboxes in Elm

Max Goldstein | July 30, 2015 | Elm 0.15.1

In Elm, signals always have a data source associated with them. Window.dimensions is exactly what you think it is, and you can't send your own events on it. You can derive your own signals from these primitives using map, filter, and merge, but the timing of events is beyond your control.

This becomes a problem when you try to add UI elements. We want to be able to add checkboxes and dropdown menus, and to receive the current state of these elements as a signal. So how do we do that?

The Bad Old Days

sebmarkbage / Enhance.js
Last active Sep 6, 2020
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
componentDidMount() {
this.setState({ data: 'Hello' });
render() {
View handler.js
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
evancz /
Last active Aug 30, 2018
A style guide for Elm tools

Haskell Style Guide for Elm

Goal: a consistent style throughout all Elm projects that is easy to read and produces clean diffs to make debugging easier. This means valuing regularity and simplicity over cleverness.

Line Length

Keep it under 80 characters. Going over is not the end of the world, but consider refactoring before you decide a line really must be longer.


lukehoban /
Last active Dec 6, 2019
ECMAScript 6 Features

Note: Up to date version now at

ECMAScript 6


ECMAScript 6 is the upcoming version of the ECMAScript standard. This standard is targetting ratifcation in December 2014. ES6 is a significant update to the language, and the first update to the language since ES5 was standardized in 2009. Implementation of these features in major JavaScript engines is underway now.

See the draft ES6 standard for full specification of the ECMAScript 6 language.

ES6 includes the following new features:

View gist:8333559
export PATH=~/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/usr/local/git/bin:/usr/local/mysql/bin:$PATH
export PATH=/usr/local/share/npm/bin:$PATH
export PATH=/usr/local/sbin:$PATH
export PATH=~/GoDev/bin:$PATH
# Other Paths
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
export GOPATH=~/GoDev
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
wolfeidau /
Created Oct 10, 2013
Wireshark recipes

Wireshark is an awesome tool especially for debugging HTTP requests done by small embedded devices. Typically the developers of http libraries on these platforms typically develop a very minimal subset of the protocol for their use case.

Debugging any compatabilty issues can be a pain in the butt, this is where wireshark comes in. It enables to look at what was transmitted across the wire and with a few rules pick up anomolies.

I have put together a few handy recipes.

This one is a brief summary of the HTTP requests.

sudo tshark -d tcp.port==8080,http -R 'http.request or http.response' -i lo0 ip and port 8080
tokenvolt / simple_form_bootstrap3.rb
Last active Apr 28, 2020
Bootstrap 3 simple form initializer
View simple_form_bootstrap3.rb
inputs = %w[
ryanflorence / static_server.js
Last active Sep 19, 2020
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
View static_server.js
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
You can’t perform that action at this time.