Skip to content

Instantly share code, notes, and snippets.

Peter Uithoven peteruithoven

View GitHub Profile
View dhcp
config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
@peteruithoven
peteruithoven / broadcaster.js
Created Oct 16, 2014
Monitoring the server using pm2 indicates a memory leak. The memory usage increased and didn't decrease. Not even when stopping broadcaster.js
View broadcaster.js
var io = require('socket.io-client');
var PORT = 6000;
var socket = io.connect('http://localhost:'+PORT,{forceNew:true});
socket.once('connect',function() {
console.log("connected");
setInterval(function() {
console.log("emit image");
for(var i=0;i<100;i++) {
View atom jspm snippets
'.text.html':
'JSPM html':
'prefix': 'html-jsmp'
'body': """
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>$3</title>
<script src="jspm_packages/system.js" charset="utf-8"></script>
@peteruithoven
peteruithoven / Using reselect in reducers
Last active Oct 26, 2015
Usage reselect in Redux reducers
View Using reselect in reducers
// We're adding COMPLETE_ALL_VISIBLE_TODOS and DELETE_ALL_VISIBLE_TODOS
// to the reducers.js example of ReduxExample: Todo List
// http://rackt.org/redux/docs/basics/ExampleTodoList.html > reducers.js
// using the visibleTodosSelector of Computing Derived Data
// http://rackt.org/redux/docs/recipes/ComputingDerivedData.html
// Using this memoized selector function enables reuse of derived data
import {visibleTodosSelector} from 'selectors/TodoSelectors.js';
function todos(state = [], action) {
@peteruithoven
peteruithoven / app.js
Last active Dec 21, 2015
Rehydrating Redux store when using systemjs hot reloader
View app.js
import {createStore} from 'redux';
import reducer from './reducers/index.js'
import { rehydrate, rehydratingStore } from './utils/rehydratingStore.js';
const store = rehydratingStore()(createStore)(reducer);
export function __reload(deletedModule){
const prevState = deletedModule.getState();
debug('Reloaded. rehydrate with state: ', prevState.sketcher.objectsById);
store.dispatch(rehydrate(prevState));
@peteruithoven
peteruithoven / Storing data over hot reloads
Last active Feb 11, 2016
Example of storing data over hot reloads (using capaj/systemjs-hot-reloader)
View Storing data over hot reloads
import getHotReloadStore from './utils/getHotReloadStore.js';
const hotStore = getHotReloadStore('d3d:store');
const state = hotStore.state || {
counter: 0
};
console.log('state: ', state);
state.counter += 1;
@peteruithoven
peteruithoven / Add meta config to config.js
Last active Feb 26, 2016
STLLoader + Three.js using SystemJS
View Add meta config to config.js
meta: {
"js/app.js": {
"deps": [
"three.js"
]
},
"three.js/loaders/STLLoader": {
"deps": [
"three.js"
]
View dato
'{"data":[{"height":9,"transform":{"metadata":{"library":"CAL","type":"Matrix"},"matrix":[0.40080160320641284,0,-100.20040080160322,0,0.40080160320641284,-102.60521042084166]},"z":0,"sculpt":[1,1],"twist":0,"points":[{"metadata":{"library":"CAL","type":"Vector"},"x":373.1,"y":192.6},{"metadata":{"library":"CAL","type":"Vector"},"x":382.7,"y":199},{"metadata":{"library":"CAL","type":"Vector"},"x":388.5,"y":205.7},{"metadata":{"library":"CAL","type":"Vector"},"x":392.4,"y":214.4},{"metadata":{"library":"CAL","type":"Vector"},"x":394.2,"y":223.1},{"metadata":{"library":"CAL","type":"Vector"},"x":393.3,"y":231.6},{"metadata":{"library":"CAL","type":"Vector"},"x":390.7,"y":240.4},{"metadata":{"library":"CAL","type":"Vector"},"x":383.9,"y":249.3},{"metadata":{"library":"CAL","type":"Vector"},"x":373.6,"y":257},{"metadata":{"library":"CAL","type":"Vector"},"x":358.7,"y":259.8},{"metadata":{"library":"CAL","type":"Vector"},"x":342.7,"y":256.9},{"metadata":{"library":"CAL","type":"Vector"},"x":331.7,"y":249.2},{"metad
View Carot-sign
'{"data":[{"height":20,"transform":{"metadata":{"library":"CAL","type":"Matrix"},"matrix":[2.532535102433726,0,-15.363289865521766,0,2.532535102433726,30.37459874467367]},"z":0,"sculpt":[1,1,1],"twist":0,"points":[{"metadata":{"library":"CAL","type":"Vector"},"x":-27.51850563144776,"y":7.269115192200452},{"metadata":{"library":"CAL","type":"Vector"},"x":-27.51850563144776,"y":7.269115192200452},{"metadata":{"library":"CAL","type":"Vector"},"x":-27.51850563144776,"y":7.269115192200452}],"type":"FREE_HAND"},{"height":20,"transform":{"metadata":{"library":"CAL","type":"Matrix"},"matrix":[2.532535102433726,0,-15.363289865521766,0,2.532535102433726,30.37459874467367]},"z":0,"sculpt":[1,1,1],"twist":0,"points":[{"metadata":{"library":"CAL","type":"Vector"},"x":-18.90636751164164,"y":3.8242599442779905}],"type":"FREE_HAND"},{"height":20,"transform":{"metadata":{"library":"CAL","type":"Matrix"},"matrix":[2.532535102433726,0,-15.363289865521766,0,2.532535102433726,30.37459874467367]},"z":0,"sculpt":[1,1,1],"twist":0,"
You can’t perform that action at this time.