Skip to content

Instantly share code, notes, and snippets.

<html>
<body>
<script type="text/javascript" charset="utf-8" src='foo.js'></script>
</body>
</html>
@int3
int3 / ls.scm
Last active December 15, 2015 17:59
An implementation of `ls', for [The Guile 100 Programs Project](http://www.lonelycactus.com/guile100/).
#! /usr/local/bin/guile -s
!#
(use-modules (srfi srfi-1) ; fold, map etc
(srfi srfi-26) ; cut (partial application)
(srfi srfi-37) ; args-fold
(ice-9 ftw)
(ice-9 format)
(ice-9 i18n))
@int3
int3 / gist:5250850
Last active December 15, 2015 11:09
Simple memcached benchmarking script.
package main
import (
"fmt";
"strings";
"time";
"math/rand";
"strconv";
"github.com/bradfitz/gomemcache/memcache"
)
@int3
int3 / hashtable.c
Created December 10, 2012 17:34
Simple open-addressed hashtable
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
// no actual pointer should have this value, due to alignment
static void* DELETED = (void*)1;
static int TABLE_SIZE = 701;
@int3
int3 / gist:4027626
Created November 6, 2012 21:17
Chained comparisons using sweet.js
macro $if {
case ($x ...) => { if (relCar($x ...)) }
}
macro $while {
case ($x ...) => { while (relCar($x ...)) }
}
// naive form:
/*
@int3
int3 / gist:4013740
Created November 4, 2012 20:57
Coffeescript's `do` notation as a sweet.js macro
macro $do {
case ($($x = $y) (,) ...) $body => {
(function ($x (,) ...) $body)($y (,) ...)
}
case $name ($($x = $y) (,) ...) $body => {
(function $name ($x (,) ...) $body)($y (,) ...)
}
}
$do (a = 1, b = 2) {
@int3
int3 / status.md
Created August 22, 2011 18:58
Session Restore e10s Status

TODO:

  • Create a notification to indicate when the active page style changes

  • We probably should not use userTypedValue (which is in chrome) to manipulate the loaded URI of a tab (which is in content.)

  • Skipping test 461743 for now -- seems like it might not be relevant once we move to e10s anyway

  • Listen for pushstate and popstate events as well?

# User Jez Ng <jezreel@gmail.com>
Bug 632555 - Scale about:sessionrestore's treeview based on viewport height. r=zpao
diff --git a/browser/components/sessionstore/content/aboutSessionRestore.xhtml b/browser/components/sessionstore/content/aboutSessionRestore.xhtml
--- a/browser/components/sessionstore/content/aboutSessionRestore.xhtml
+++ b/browser/components/sessionstore/content/aboutSessionRestore.xhtml
@@ -81,17 +81,16 @@
<ul>
<li>&restorepage.restoreSome;</li>
@int3
int3 / deanon.py
Created July 20, 2011 03:15
De-anonymize JS functions
#! /usr/bin/env python
"""
Usage: cat [infile] | python deanon.py > [outfile]
Anonymous functions will be renamed to anon_[lineno]_*
where * is a number that gets incremented for each functionon the line
"""
from sys import stdin, stdout, stderr, argv
@int3
int3 / postprocess.py
Created July 20, 2011 01:23
Postprocess chrome->content analysis output
#! /usr/bin/env python
"""
Usage: python postprocess.py [logfile] [src files we're interested in] > out.html
Incl.: offending calls from callee get added to the caller's count
Excl.: offending calls from callee do not get added to the caller's count
"""
import sys, re
from collections import defaultdict