Skip to content

Instantly share code, notes, and snippets.

Avatar

John Resig jeresig

View GitHub Profile
@jeresig
jeresig / output.txt
Last active Sep 5, 2017
worker-nodes big data transfer performance
View output.txt
$ node test_server.js
simple: 337.425ms
simple2: 1.971ms
big data: 3385.748ms
big data stringify: 801.013ms
big string: 565.437ms
View test.js
tap.test("RecordImport.advance", (t) => {
const checkStates = (batches, states) => {
t.equal(batches.length, states.length);
for (const batch of batches) {
t.equal(batch.state, states.shift());
t.ok(batch.getCurState().name(i18n));
}
};
const batch = init.getRecordBatch();
@jeresig
jeresig / block-puzzle.js
Created Dec 27, 2016
Super-hacky solver for the "Gopher Holes" puzzle: http://amzn.to/2hqLO2V
View block-puzzle.js
/**
* Super-hacky solver for the "Gopher Holes" puzzle:
* http://amzn.to/2hqLO2V
*
* Note: I assumed that the blocks would be going vertically in one direction
* and horizontally in another.
*
* Also: I wrote this for fun over the holidays - I'm sure this code is
* terrible and could be improved. It was good enough for my needs!
*
@jeresig
jeresig / frick.json
Last active Feb 15, 2016
Sample artwork metadata records for PHAROS Images.
View frick.json
{
"id": "b11104624",
"url": "http://arcade.nyarc.org/record=b1110462~S7",
"lang": "en",
"title": "S. John the Baptist Enthroned and Twelve Scenes from His Life.",
"dates": [
{
"start": 1200,
"end": 1299,
"circa": false
View nyt-upshot.css
@media screen and (max-width: 719px) {
.nytint-upshot-stream-item-bCol {
margin: 0;
}
.nytint-upshot-stream-item .photo.embedded.layout-large-horizontal,
.nytint-upshot-stream-item-article .story-heading {
max-width: 100%;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am jeresig on github.
  • I am jeresig (https://keybase.io/jeresig) on keybase.
  • I have a public key whose fingerprint is 1720 9477 977B 343F EC42 B6D4 1E87 2B3A D262 C861

To claim this, I am signing this object:

@jeresig
jeresig / cookiebot.js
Last active Jul 27, 2020
Simple bot for CookieClicker: http://orteil.dashnet.org/cookieclicker/ How to use: Paste the following into the JavaScript console in your browser and run it. To start the bot type: "CookieClicker.start();" to stop it do: "CookieClicker.stop();" (or just reload the page).
View cookiebot.js
CookieClicker = {
start: function() {
this.clickInterval = setInterval(function(){
// Click the large cookie as fast as possible!
document.getElementById("bigCookie").click();
}, 1);
this.goldInterval = setInterval(function(){
// Click the golden cookie
var shimmer = document.getElementsByClassName("shimmer")[0];
View bananabread-asm.js
function Vb(d) {
d = d | 0;
var e = 0, f = 0, h = 0, j = 0, k = 0, l = 0, m = 0, n = 0,
o = 0, p = 0, q = 0, r = 0, s = 0;
e = i;
i = i + 12 | 0;
f = e | 0;
h = d + 12 | 0;
j = c[h >> 2] | 0;
if ((j | 0) > 0) {
View i18n Swig Textmate Snippet
#!/usr/bin/env ruby
$: << ENV['TM_SUPPORT_PATH'] + '/lib'
require 'escape'
def esc(str)
e_sn(str).gsub(/\}/, '\\}').gsub(/"/, '\\\\"')
end
s = STDIN.read
if ENV.has_key? 'TM_SELECTED_TEXT'
print "${1:{{ __(\"#{esc s}\") \\}\\}}"
View .vimrc
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
You can’t perform that action at this time.