Skip to content

Instantly share code, notes, and snippets.

Peter Uithoven peteruithoven

View GitHub Profile
@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"
]
@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;
View rafUpdateBatcher.js
/*
* Utility to only call Redux updates in RequestAnimationFrame's
* Also uses React-dom's batchedUpdates
*/
import raf from 'raf';
import { unstable_batchedUpdates as batchedUpdates } from 'react-dom';
let rafID;
let notifyFunc;
function animFrame() {
@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 / 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) {
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 / 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 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'
You can’t perform that action at this time.