Skip to content

Instantly share code, notes, and snippets.

@Happy-Ferret
Happy-Ferret / .mozconfig
Created January 11, 2017 13:38 — forked from EricRahm/.mozconfig
Example mozconfigs
ac_add_options --enable-debug
ac_add_options --enable-dmd
# NB: ccache disabled for comparitive build time testing.
#ac_add_options --with-ccache=/usr/bin/ccache
MOZ_MAKE_FLAGS="-j12"
export LD="/usr/bin/gold"
# For gcc-6.3.0
@Happy-Ferret
Happy-Ferret / prettyjson
Created January 23, 2017 16:21 — forked from expandrive/prettyjson
Take JSON from stdin and dump it to stdout in a more readable form
#!/usr/bin/python
# From http://stackoverflow.com/questions/352098/how-to-pretty-print-json-script
# To install paste this into a file named prettyjson that lives in your PATH
# e.g.
# sudo touch /usr/bin/prettyjson
# sudo open -t /usr/bin/prettyjson
# paste this file and save
# sudo chmod +x /usr/bin/prettyjson
"""
@Happy-Ferret
Happy-Ferret / pull_zmq.py
Created February 12, 2017 09:56 — forked from mgunneras/pull_zmq.py
Publish data from file or stdin to a zmq socket
#! /usr/bin/env python
"""
Prints data from zmq PULL socket to stdout
"""
import zmq
import sys
def get_socket(host, port):
context = zmq.Context()
@Happy-Ferret
Happy-Ferret / Enhance.js
Created February 26, 2017 08:17 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@Happy-Ferret
Happy-Ferret / broker.go
Created February 28, 2017 08:41 — forked from maliqq/broker.go
Golang message broker
package protocol
import (
"fmt"
"log"
)
// pubsub
type Broker struct {
Send map[string]*chan *Message
@Happy-Ferret
Happy-Ferret / gist:adb5d4bbb552aa9bd2b43fefcd89c576
Created March 2, 2017 06:25 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "[email protected]:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@Happy-Ferret
Happy-Ferret / es6-dom-extend.js
Created March 17, 2017 10:00 — forked from hemanth/es6-dom-extend.js
Extend DOM elements ES6
class SmartButton extends HTMLButtonElement {
constructor() {}
}
let sb = new SmartButton();
document.body.appendChild(sb);
/*
I get the below error:
TypeError: Failed to execute 'appendChild'
@Happy-Ferret
Happy-Ferret / connpair.go
Created March 19, 2017 11:28 — forked from tsavola/connpair.go
Like socketpair, but for Golang, and TCP instead of Unix sockets
package connpair
import (
"net"
)
func ConnPair() (serverConn, clientConn net.Conn, err error) {
l, err := net.Listen("tcp", "localhost:0")
if err != nil {
return
@Happy-Ferret
Happy-Ferret / coverage_recipe.md
Created March 22, 2017 21:04 — forked from gregglind/coverage_recipe.md
Code Coverage in Mozilla Code