Skip to content

Instantly share code, notes, and snippets.

View goatslacker's full-sized avatar

Josh Perez goatslacker

View GitHub Profile
@goatslacker
goatslacker / node-jsdiff
Created June 27, 2011 19:52
node-jsdiff - John Resig's Diff modified to work with NodeJS and output in colors
/*global module */
/*
* Javascript Diff Algorithm
* By John Resig (http://ejohn.org/)
* Modified by Chu Alan "sprite"
* Modified by Josh Perez <josh@goatslacker.com>
*
* Released under the MIT license.
*
* More Info:
@goatslacker
goatslacker / seqexec.js
Created June 27, 2011 23:05
Sequentially execute commands NodeJS
#!/usr/bin/env node
/*global require process */
const exec = require('child_process').exec;
/**
Returns a function to be executed
@param cmd {string} the command to run
@param callback {Function} the Function to execute after the command finishes running
*/
@goatslacker
goatslacker / gist:6004481
Created July 15, 2013 23:36
time tracking local
" Lets me know how much time I've spent editing a file
" Keyboard shortcut -> \dt
augroup TimeSpentEditing
au!
au BufWinEnter * if !exists('b:tstart')|let b:tstart=reltime()|en
augroup END
function! TimeSpentEditing()
let secs = str2nr(reltimestr(reltime(b:tstart)))
let hours = secs / 3600
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");
var Alt = require('alt')
var alt = new Alt()
function Actions() {
}
Actions.prototype.fetchCat = function* () {
yield 1;
yield 2;
yield 3;

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:

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))
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 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},