Skip to content

Instantly share code, notes, and snippets.

View jeongsd's full-sized avatar
🎯
Focusing

Jeong Seong Dae jeongsd

🎯
Focusing
View GitHub Profile
@jeongsd
jeongsd / mine.js
Created August 20, 2021 01:35
지뢰찾기
const UNREVEALED_MINE = "M";
const UNREVEALED_EMPTY = "E";
const REVEALED_BLANK = "B";
const REVEALED_MINE = "X";
const adjacentIndexes = [
[-1, -1],
[-1, 0],
[-1, 1],
@jeongsd
jeongsd / machine.js
Created June 1, 2021 07:53
Generated by XState Viz: https://xstate.js.org/viz
const searchValid = (context, event) => {
return context.canSearch && event.query && event.query.length > 0;
}
const searchMachine = Machine(
{
id: 'search',
initial: 'idle',
context: {
canSearch: true
@jeongsd
jeongsd / RouteConst.js
Created July 21, 2017 22:10
react router constants
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);
}
}
@jeongsd
jeongsd / index.js
Last active May 19, 2018 01:51
idle
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
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")
@jeongsd
jeongsd / 0_reuse_code.js
Created May 23, 2017 21:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
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 = {
@jeongsd
jeongsd / AnimationFrame.js
Last active March 5, 2017 14:01 — forked from addyosmani/limitLoop.js
Limit the frame-rate being targeted with requestAnimationFrame
/*
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;
}
@jeongsd
jeongsd / limitLoop.js
Created March 5, 2017 13:59 — forked from addyosmani/limitLoop.js
Limit the frame-rate being targeted with requestAnimationFrame
/*
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
#!/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()