Skip to content

Instantly share code, notes, and snippets.

View goatslacker's full-sized avatar

Josh Perez goatslacker

View GitHub Profile
import * as sql from "sqlite";
import * as Discord from "discord.js";
import getL10nFunction from "./src/constants/messages";
const ROUNDS = 10;
// TODO configurable
const L10n = getL10nFunction("EN");
async function getDB(): Promise<sql.Database> {
const db = await sql.open("./pokedraft.sqlite");

Keybase proof

I hereby claim:

  • I am goatslacker on github.
  • I am goatslacker (https://keybase.io/goatslacker) on keybase.
  • I have a public key ASD-2-2QhDQGJttBzY79_etlXj_Ct_OdvEVgVhQ3uhirkwo

To claim this, I am signing this object:

const {
applyMiddleware,
} = require('redux')
function applyGlobalMiddleware(...globalMiddlewares) {
return createStore => (reducer, preloadedState, enhancer) => {
const scopedMiddleware = []
const injectableMiddleware = store => next => action => {
const chain = scopedMiddleware.map(m => m(store))
import { createStore, compose, applyMiddleware } from 'redux'
export default function createInjectableStore(reducers, preloadedState, enhancer) {
const injectedMiddleware = []
const injectableMiddleware = store => next => action => {
const chain = injectedMiddleware.map(m => m(store))
const dispatchThroughMiddleware = chain.reduceRight((next, f) => {
return f(next)
}, action => next(action))
import math
pokemon = {
"bulbasaur":{"stamina":90,"attack":118,"defense":118},
"ivysaur":{"stamina":120,"attack":151,"defense":151},
"venusaur":{"stamina":160,"attack":198,"defense":198},
"charmander":{"stamina":78,"attack":116,"defense":96},
"charmeleon":{"stamina":116,"attack":158,"defense":129},
"charizard":{"stamina":156,"attack":223,"defense":176},
"squirtle":{"stamina":88,"attack":94,"defense":122},
import math
pokemon = {
"bulbasaur":{"stamina":90,"attack":118,"defense":118},
"ivysaur":{"stamina":120,"attack":151,"defense":151},
"venusaur":{"stamina":160,"attack":198,"defense":198},
"charmander":{"stamina":78,"attack":116,"defense":96},
"charmeleon":{"stamina":116,"attack":158,"defense":129},
"charizard":{"stamina":156,"attack":223,"defense":176},
"squirtle":{"stamina":88,"attack":94,"defense":122},
[
{
"id": 1,
"name": "BULBASAUR",
"type1": "GRASS",
"type2": "POISON",
"stats": {
"stamina": 90,
"attack": 118,
"defense": 118
@goatslacker
goatslacker / bench-react.js
Created October 10, 2016 17:34
Benchmarking React with different variances like props, components, markup size, etc
const Benchmark = require('benchmark');
const React = require('react/dist/react.min');
const ReactDOMServer = require('react-dom/dist/react-dom-server.min');
const suite = new Benchmark.Suite();
// ==========================================================================
// LotsOfBytes test:
// > A metric shit ton of markup output by a single React element.
function Matchup(props) {
const matchups = props.name ? idealMatchup.overall(props.name) : []
return (
$(B.View, [
$(B.Header, 'Ideal Matchup'),
$(B.Text, 'This is calculated based on the opposing Pokemon\'s type and assuming the opponent has the best possible moveset combination for their Pokemon. The results do not include legendaries. Pokemon type effectiveness and resistances are also taken into account.'),
$('hr'),
$(FormPokemonName, { name: props.name }),
matchups.length ? (
$(B.Table, {
[][(![]+[])[!+[]+!![]+!![]]+([]+{})[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][([]+{})[!+[]+!![]+!![]+!![]+!![]]+([]+{})[+!![]]+([][[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+{})[!+[]+!![]+!![]+!![]+!![]]+(!![]+[])[+[]]+([]+{})[+!![]]+(!![]+[])[+!![]]](([]+{})[!+[]+!![]+!![]+!![]+!![]]+([]+{})[+!![]]+([][[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+([]+{})[+!![]]+(![]+[])[!+[]+!![]]+([][[]]+[])[!+[]+!![]+!![]]+[][(![]+[])[!+[]+!![]+!![]]+([]+{})[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][([]+{})[!+[]+!![]+!![]+!![]+!![]]+([]+{})[+!![]]+([][[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+{})[!+[]+!![]+!![]+!![]+!![]]+(!![]+[])[+[]]+([]+{})[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([]+{})[!+[]+!![]+!![]+!![]+!![]+!![]+!![]]+([][[]]+[])[+[]]+([][[]]+[])[+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(![]+[])[!+[]+!![]+!![]]+([]+{})[!+[]+!![]+!![]