Skip to content

Instantly share code, notes, and snippets.

John Resig jeresig

Block or report user

Report or block jeresig

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jeresig
jeresig / cookiebot.js
Last active Feb 12, 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 .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
View gist:199298
# Rename an email address in all old commits.
# WARNING: Will change all your commit SHA1s.
# Based off of the script from here:
# http://coffee.geek.nz/how-change-author-git.html
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "joern.zaefferer@googlemail.com" ];
then
GIT_AUTHOR_EMAIL="joern.zaefferer@gmail.com";
GIT_COMMITTER_EMAIL="joern.zaefferer@gmail.com";
git commit-tree "$@";
@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 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 gist:164163
// Slightly rewritten code from here:
// http://blog.mozilla.com/webdev/2009/08/06/html5-audio-soundboard/
$("audio").removeAttr("controls").each(function(i, audio) {
$('<button>')
.text( $(this).attr("title") )
.click(function() {
audio.play();
))
.appendTo("#doc");
});
You can’t perform that action at this time.