Skip to content

Instantly share code, notes, and snippets.

View asbjornenge's full-sized avatar
Swinging madly across the sun.

Asbjorn Enge asbjornenge

Swinging madly across the sun.
View GitHub Profile
@asbjornenge
asbjornenge / reactTestQueryUtil.js
Last active August 29, 2015 14:05
React test utils wrapper
var React = require('react')
var ReactAddons = require('react/addons')
var ReactTestUtils = React.addons.TestUtils
var reactTestQueryUtil = function (tree) {
this.tree = tree
}
reactTestQueryUtil.prototype.class = function (cls) {
this.class = cls
return this
@asbjornenge
asbjornenge / reload.js
Created July 31, 2014 21:34
"Livereload" for node-webkit
var reloadSocket = new WebSocket('ws://localhost:35730');
reloadSocket.onmessage = function(msg) {
if (msg.data === 'reload') setTimeout(function() { location.reload(); },10)
}
@asbjornenge
asbjornenge / gist:30e9e85cb208ea544ff8
Created July 22, 2014 09:38
DirtyIgnoreUnmountedReactMixin
module.exports = {
componentWillMount : function() {
this._replaceState = this.replaceState
this.replaceState = function(completeState, callback) {
if (!this.isMounted()) return
this._replaceState(completeState, callback)
}
}
}
-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
hQEMA3WsbN3t0QYIAQf/SMcQs1+rMkbelITRrOrZLuJnTyIlfIRPR/OoT58aVMAQ
ax6tOYV/tLOgfH5OWGGVCiVBpdeqMbx66BelReAdu6lG7cHwcgrU+HlMuj+qscdx
VPMWW5sV6mpgH8jgKnW9pv/rS09n4yvIOdk2x+6aBCCn0iqdn3xtxrWVA8pJecyX
93F1tMIq+No7tp0OXdEhzGagMadgGt/GXHEiUZGj40mYrI8YjE6BVSMi3ZLRoCXE
eUG7f17ba/MxXD/00gKHUjczPSWeGpn67oDQrCS2pSCKBiBBPk+0lKIaOBG9HaHL
JDTtfBhVMv23Cm/E6YUOBa+xxa8vqq0O1IE2XbVoF9KQAfH6lFSQJbryemiIKjKp

Keybase proof

I hereby claim:

  • I am asbjornenge on github.
  • I am asbjornenge (https://keybase.io/asbjornenge) on keybase.
  • I have a public key whose fingerprint is DDDC 3218 67A6 B10E 7FC2 A876 6264 E527 FA86 4B12

To claim this, I am signing this object:

/*
* node-ws - pure Javascript WebSockets server
* Copyright Bradley Wright <[email protected]>
*/
// Use strict compilation rules - we're not animals
'use strict';
var net = require('net'),
crypto = require('crypto');
@asbjornenge
asbjornenge / nanodom.js
Last active December 31, 2015 22:29
Nanodom.js - a very small dom manipulation library.
define([], function() {
function dom() {}
dom.prototype = new Array;
dom.prototype.append = function(element) { element.map(function(e) { this[0].appendChild(e) }.bind(this)); return this}
dom.prototype.remove = function() { this.map(function(e) {e.parentNode.removeChild(e)}); return this}
dom.prototype.prepend = function(element) { element.map(function(e) { this[0].insertBefore(e, this[0].childNodes[0]) }.bind(this)); return this}
dom.prototype.empty = function(elements) { this.map(function(e) { e.innerHTML = ""}); return this}
dom.prototype.addClass = function(classes) { this.map(function(e) { e.className += ' '+classes}); return this}
dom.prototype.removeClass = function(classes) {
@asbjornenge
asbjornenge / mapMonad.js
Created November 21, 2013 21:56
So, is this a monad?
// _* implementations go here. They all return a list of locations.
var MapMonad = function(locations) {
return {
fit : function(map) { return MapMonad(_fit(locations, map)); },
sprinkle : function(map) { return MapMonad(_sprinkle(locations, map)); },
mark : function(map) { return MapMonad(_mark(locations, map)); },
hide : function() { return MapMonad(_hide(locations)); },
filter : function(fn) { return MapMonad(_filter(fn)); },
locations : locations
@asbjornenge
asbjornenge / markdown.css
Last active December 17, 2021 08:58
Markdown css
.markdown {
background-color: white;
padding: 20px;
max-width: 800px;
margin: auto;
}
.markdown a {
color: #4183C4 !important; }
.markdown a.absent {

Unionize: network superpowers for your docker containers

Unionize lets you connect together docker containers in arbitrarily complex scenarios.

Just check those examples.

LAMP stack with a private network between the MySQL and Apache containers

Let's create two containers, running the web tier and the database tier: