Skip to content

Instantly share code, notes, and snippets.

Having fun

Alexander Fallenstedt Fallenstedt

Having fun
View GitHub Profile
View progress-bar.js
<!-- Refer to collective.js for loadscreen code. -->
<div id="overlay">
<div id="progstat"></div>
<div id="progress"></div>
//loading animation:
View isItAprilFoolDay()
/* Check if it is april fools day */
var aprilFools = {
month: 3,
date: 1
function isItAprilFoolDay() {
var now = new Date();
return (now.getMonth() == aprilFools.month && now.getDate() ==;
Fallenstedt /
Created Jan 24, 2017 — forked from DanHerbert/
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.


This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

View EmittingComponent.js
import React from 'react'
import mrEmitter from '../helpers/mrEmitter'
export default class EmittingComponent extends React.Component {
handleClick = () => {
mrEmitter.emit('onSomeEvent', 'foo sends bar')
render() {
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<script src="">
Fallenstedt /
Created Jul 10, 2017 — forked from yoavniran/
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies

View simple cube scene
<title>My first three.js app</title>
body { margin: 0; }
canvas { width: 100%; height: 100% }
<script src=""></script>
View sass rem calulator
// Default font size set by browsers 16px
$browser-context: 16;
// Calculates the rem value so it can be applied everywhere;
// @param an integer font size in px
// @param an integer reference size in px
// @return a string with rem unit.
@function rem($pixels, $context: $browser-context) {
Fallenstedt / Bridge Ports across a VM
Last active Jan 18, 2018
bridge ports from a VM to root
View Bridge Ports across a VM
netsh interface portproxy add v4tov4 listenport=8001 listenaddress= connectport=8001 connectaddress=
# Change listenport and connectport to the port you desire
Working on a mac and need to test on IE 11 or Edge with a local dev build? Get a VM for the browser you need from
Then open command prompt as admin and pase the code above with the port you need. As an example I may have a local sever on port 3000 on mac.
I need my VM to see this port. I replace connectport and listen port with 3000 and paste this magical line into command prompt to build
the bridge I need.
View gist:af208cb7737ffe03048fa1620292de4a
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master