Skip to content

Instantly share code, notes, and snippets.

@eanplatter
eanplatter / LED.js
Created August 15, 2016 03:47
LED style number conversion in JavaScript / Node.
const argv = require('process').argv
/**
* numbers - an object which lists out the ascii art of each number.
* It's kind of weird that they key for each object is a string, and that
* the string is a number. Not conventional but convenient as it allows you
* to reference `numbers['0']` to get the property on the numbers object.
*/
const numbers = {
'0': {
@eanplatter
eanplatter / Counter.js
Created August 30, 2016 15:07
An attempt at doing an Elm architecture style React component.
import React, { Component } from 'react'
import { render } from 'react-dom'
const INCREMENT = 'increment'
const DECREMENT = 'decrement'
class App extends Component {
// model
state = {
counter: 0
@eanplatter
eanplatter / scope-and-closures.md
Last active October 17, 2016 14:56
Scope issues with JavaScript

Hello Student!

Here is your original code:

<button id="btn-0">Button 1!</button>
<button id="btn-1">Button 2!</button>
<button id="btn-2">Button 3!</button>

<script type="text/javascript">
  var prizes = ['A Unicorn!', 'A Hug!', 'Fresh Laundry!'];

Student Questions

Here are a list of the answers to the given questions. I have omitted the questions because some of them are long.

JavaScript

Hello Student!

Here is your original code:

<button id="btn-0">Button 1!</button>
<button id="btn-1">Button 2!</button>
@eanplatter
eanplatter / index.html
Created February 25, 2019 17:03
Loop vs forEach vs recursion (https://jsbench.github.io/#c5c95dd2ea81c10feb7765b385b6b5e4) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Loop vs forEach vs recursion</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>