Skip to content

Instantly share code, notes, and snippets.

View Fallenstedt's full-sized avatar
:octocat:
Having fun

Alexander Fallenstedt Fallenstedt

:octocat:
Having fun
View GitHub Profile
@Fallenstedt
Fallenstedt / progress-bar.js
Last active June 30, 2016 18:04
Progress Bar
//HTML
<!-- Refer to collective.js for loadscreen code. -->
<div id="overlay">
<div id="progstat"></div>
<div id="progress"></div>
</div>
//CSS
//loading animation:
#overlay{
/* 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() == aprilFools.date);
}
@Fallenstedt
Fallenstedt / fix-homebrew-npm.md
Created January 24, 2017 04:23 — forked from DanHerbert/fix-homebrew-npm.md
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.

Solution

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.

@Fallenstedt
Fallenstedt / EmittingComponent.js
Created April 6, 2017 03:43 — forked from puranjayjain/EmittingComponent.js
Using fbemitter-https://github.com/facebook/emitter/ (An event emitter) with React + ES6
import React from 'react'
import mrEmitter from '../helpers/mrEmitter'
export default class EmittingComponent extends React.Component {
handleClick = () => {
mrEmitter.emit('onSomeEvent', 'foo sends bar')
}
render() {
@Fallenstedt
Fallenstedt / index.html
Created June 8, 2017 21:05
Pixi JS example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.5.2/pixi.min.js">
</script>
</head>
<body>
@Fallenstedt
Fallenstedt / ultimate-ut-cheat-sheet.md
Created July 10, 2017 01:29 — forked from yoavniran/ultimate-ut-cheat-sheet.md
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


@Fallenstedt
Fallenstedt / simple cube scene
Created November 10, 2017 06:06
Three js cube
<html>
<head>
<title>My first three.js app</title>
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/88/three.min.js"></script>
// 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
Fallenstedt / gist:af208cb7737ffe03048fa1620292de4a
Created January 2, 2018 01:11 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#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
@Fallenstedt
Fallenstedt / Bridge Ports across a VM
Last active January 18, 2018 22:07
bridge ports from a VM to root
netsh interface portproxy add v4tov4 listenport=8001 listenaddress=127.0.0.1 connectport=8001 connectaddress=10.0.2.2
# 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 developer.microsoft.com
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.