Skip to content

Instantly share code, notes, and snippets.

View taylorlapeyre's full-sized avatar

Taylor Lapeyre taylorlapeyre

View GitHub Profile
const dictionary = {
"one": 1,
"two": 2,
"three": 3,
"four": 4,
"five": 5,
"six": 6,
"seven": 7,
"eight": 8,
"nine": 9,
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function roll20() {
return getRandomInt(1, 20);
}
@taylorlapeyre
taylorlapeyre / react?.js
Last active July 23, 2018 17:46
React if jsx was actually just arrays like ["h1", "Hello World"]
const Ops = {
CREATE: "CREATE",
UPDATE: "UPDATE",
DELETE: "DELETE",
KEEP: "KEEP"
};
function constructTree(dom) {
if (dom.nodeType === document.TEXT_NODE) {
return dom.textContent;
export function createElement(tagName, options, ...children) {
// If the "tagName" is a function, we assume it is a custom element and delegate element creation to it.
// Otherwise, we create a new Element ourselves.
const isCustomElement = typeof tagName === 'function'
const element = isCustomElement ? tagName(options) : document.createElement(tagName)
if (!options) {
return element
}
@taylorlapeyre
taylorlapeyre / studying.js
Last active December 30, 2015 13:29
Straddling the border between procrastination and usefulness.
// feynman algorithm:
// - Write down a problem about [subject]
// - Think very hard
// - Write down the answer
// study:
// - For each [chapter] in [class]:
// - Write down the three most important things in [chapter]
// - For each [subject] in [chapter]:
@taylorlapeyre
taylorlapeyre / raddix.cpp
Last active December 27, 2015 13:09
Radix VS Quick sort
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int compare(const void *a, const void *b)
{
return *(int*)a - *(int*)b;
}
@taylorlapeyre
taylorlapeyre / avl.cpp
Last active December 26, 2015 08:09
AVL Tree
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
struct node
{
int key;
$(window).load(function () {
var $container = $('.items');
$container.imagesLoaded(function () {
$container.isotope({
itemSelector: '.item-small'
});
});
});
@taylorlapeyre
taylorlapeyre / elements.js
Created September 24, 2013 17:47
Elements
var elements = ["Am", "Ar", "As", "At", "Au", "B", "Ba", "Be", "Bh", "Bi", "Bk", "Br", "C", "Ca", "Cd", "Ce", "Cf", "Cl", "Cm", "Co", "Cn", "Cr", "Cs", "Cu", "Db", "Ds", "Dy", "Er", "Es", "Eu", "F", "Fe", "Fm", "Fr", "Ga", "Gd", "Ge", "H", "He", "Hf", "Hg", "Ho", "Hs", "I", "In", "Ir", "K", "Kr", "La", "Li", "Lr", "Lu", "Md", "Mg", "Mn", "Mo", "Mt", "N", "Na", "Nb", "Nd", "Ne", "Ni", "No", "Np", "O", "Os", "P", "Pa", "Pb", "Pd", "Pm", "Po", "Pr", "Pt", "Pu", "Ra", "Rb", "Re", "Rf", "Rg", "Rh", "Rn", "Ru", "S", "Sb", "Sc", "Se", "Sg", "Si", "Sm", "Sn", "Sr", "Ta", "Tb", "Tc", "Te", "Th", "Ti", "Tl", "Tm", "U", "Uu", "Uu", "Uu", "Uu", "Uu", "Uu", "Uu", "Uu", "V", "W", "Xe", "Y", "Yb", "Zn"];
@taylorlapeyre
taylorlapeyre / test.py
Created September 24, 2013 17:21
TEST
hgg