This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const UNREVEALED_MINE = "M"; | |
const UNREVEALED_EMPTY = "E"; | |
const REVEALED_BLANK = "B"; | |
const REVEALED_MINE = "X"; | |
const adjacentIndexes = [ | |
[-1, -1], | |
[-1, 0], | |
[-1, 1], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const searchValid = (context, event) => { | |
return context.canSearch && event.query && event.query.length > 0; | |
} | |
const searchMachine = Machine( | |
{ | |
id: 'search', | |
initial: 'idle', | |
context: { | |
canSearch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timer = 5000; | |
var idleImg = "https://i.imgur.com/7LYQc5Y.jpg"; | |
var idleSound = 'http://soundbible.com/mp3/Female_Scream_Horror-NeoPhyTe-138499973.mp3'; | |
eval(` (function(){var a;document.addEventListener||(document.attachEvent?document.addEventListener=function(a,b,c){return document.attachEvent("on"+a,b,c)}:document.addEventListener=function(){return{}}),document.removeEventListener||(document.detachEvent?document.removeEventListener=function(a,b){return document.detachEvent("on"+a,b)}:document.removeEventListener=function(){return{}}),a={},a=function(){function a(a){var b,c;a&&(this.awayTimeout=parseInt(a.awayTimeout,10),this.onAway=a.onAway,this.onAwayBack=a.onAwayBack,this.onVisible=a.onVisible,this.onHidden=a.onHidden),c=this,b=function(){return c.onActive()},window.addEventListener("click",b),window.addEventListener("mousemove",b),window.addEventListener("mouseenter",b),window.addEventListener("keydown",b),window.addEventListener("scroll",b),window.addEventListener("mousewheel",b),window.addEventLis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadCss(filename) { | |
var cssNode = document.createElement("link"); | |
cssNode.setAttribute("rel", "stylesheet"); | |
cssNode.setAttribute("type", "text/css"); | |
cssNode.setAttribute("href", filename); | |
document.getElementsByTagName("head")[0].appendChild(cssNode); | |
} | |
loadCss("https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathToRegexp from 'path-to-regexp'; | |
class RouteConst { | |
constructor(path, parent = null) { | |
this.path = parent ? `${parent.path}${path}` : path; | |
this.toURL = pathToRegexp.compile(this.path); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
import styled from 'styled-components'; | |
const Styled__placeholder__ = styled.div` | |
`; | |
class __placeholder__ extends Component { | |
static propTypes = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
limitLoop.js - limit the frame-rate when using requestAnimation frame | |
Released under an MIT license. | |
When to use it? | |
---------------- | |
A consistent frame-rate can be better than a janky experience only | |
occasionally hitting 60fps. Use this trick to target a specific frame- | |
rate (e.g 30fps, 48fps) until browsers better tackle this problem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
http://cssdeck.com/labs/embed/gvxnxdrh/0/output | |
http://codetheory.in/controlling-the-frame-rate-with-requestanimationframe/ | |
*/ | |
class AnimationFrame { | |
constructor(fps = 60, animate) { | |
this.requestID = 0; | |
this.fps = fps; | |
this.animate = animate; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import math | |
import collections | |
import types | |
def main(): | |
quit = "Ctrl+Z, Enter" | |
prompt = "Enter an expression ({} to quit): ".format(quit) | |
current = types.SimpleNamespace(letter="A") | |
globalContent = global_context() |