Skip to content

Instantly share code, notes, and snippets.

Avatar

Thiago F slacktracer

  • An island.
View GitHub Profile
@slacktracer
slacktracer / index.html
Created Nov 13, 2021
Infectio — a puzzle game #codevember
View index.html
<main>
<controls>
<div class="new-game">New Game</div>
<div>Moves <span class="moves">0</span> / <span class="max-moves">30</span></div>
</controls>
<board></board>
<colors></colors>
<controls>
<div>Skill <span class="skill">0</span></div>
<div><input type="range" class="level" value="10" min="3" max="10" /></div>
@slacktracer
slacktracer / index.html
Created Nov 13, 2021
side scroller v0.6 (matter.js)
View index.html
<div id="keysleft">
move: WASD
<br>hold/drop: E
<br>pause: F
<br>gravity: R
</div>
<div id="keysright">
zoom: + -
<br>fire: click
<br>testing: T
@slacktracer
slacktracer / index.html
Created Nov 13, 2021
platformer v0.1 (matter.js)
View index.html
<svg height = '800' width = '1200'>
<g id="grid" stroke="#f2f2f2">
<line x1="0" y1="0" x2="3000" y2="0" style="stroke-dasharray:1,58,1,0;stroke-width:3000;"/>
<line x1="0" y1="0" x2="0" y2="3000" style="stroke-dasharray:1,58,1,0;stroke-width:3000;"/>
</g>
</svg>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Controls: arrow keys
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@slacktracer
slacktracer / mochainstance.mjs
Created Feb 18, 2018 — forked from anonymous/mochainstance.mjs
Mocha ES Modules Example
View mochainstance.mjs
import Mocha from "mocha"
export default new Mocha()
View context.js
let context = {};
context.createContext = function (fn) {
let name = "context" + Math.floor(Math.random() * 10000000);
Object.defineProperty(fn, "name", {value: name});
let params = {};
global[name] = params;
fn(params);
delete global[name];
};
View pollard
const makeG = n => x => (x ** 2 + 1) % n;
const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b));
const pollard = n => {
const g = makeG(n);
let x = 1;
let y = 2;
View flatten.js
const flatten = function flatten(array) {
const flattened = array.reduce(
function reducer(reduced, arrayItem) {
const arrayItemIsArray = Array.isArray(arrayItem);
if (arrayItemIsArray) return reduced.concat(flatten(arrayItem));