Skip to content

Instantly share code, notes, and snippets.

@indygreg
indygreg / test.js
Last active December 14, 2015 10:39
JavaScript testing framework
/**
* This is a proof of concept for a JS testing API.
*
* The eventual goal is to unify and replace the testing API across all of Firefox's
* testing frameworks (xpcshell, mochitest, etc).
*
* How it Works
* ===========
* Tests are declared in JavaScript files which are loaded by a test harness dependent
* mechanism. Traditionally, the set of files is declared in a manifest somewhere and
@indygreg
indygreg / print_random_ints.py
Created November 25, 2012 00:27
Logging Benchmarks
#!/usr/bin/python
# Print N integers have M digits.
#
# Usage: print_random_ints.py digit-count count
import random
import sys
digit_count = int(sys.argv[1])
@indygreg
indygreg / gist:3085797
Created July 10, 2012 19:51
mozilla-warnings
accessible/src/base/nsAccessiblePivot.cpp:81:1330 [-Wdelete-non-virtual-dtor] delete called on 'nsAccessiblePivot' that has virtual functions but non-virtual destructor
accessible/src/base/nsCoreUtils.cpp:206:24 [-Wtautological-compare] comparison of unsigned expression >= 0 is always true
accessible/src/generic/ARIAGridAccessible.cpp:268:12 [-Wunused-variable] unused variable 'rowCount'
accessible/src/generic/HyperTextAccessible.cpp:1812:8 [-Wunused-variable] unused variable 'isOnlyCaret'
accessible/src/html/HTMLTableAccessible.cpp:769:12 [-Wunused-variable] unused variable 'rv'
accessible/src/html/HTMLTableAccessible.cpp:789:12 [-Wunused-variable] unused variable 'rv'
accessible/src/mac/mozAccessible.mm:314:295 [-Wformat-extra-args] data argument not used by format string
accessible/src/mac/mozAccessible.mm:634:324 [-Wformat-extra-args] data argument not used by format string
accessible/src/mac/mozAccessible.mm:653:296 [-Wformat-extra-args] data argument not used by format string
accessible/src/mac/mozAcces
@indygreg
indygreg / find_old_lines.pl
Created June 17, 2012 20:17
Find oldest lines in git repository
#!/usr/bin/perl
# This script parses Git blame's "porcelain" output format and
# ascertains the oldest lines of code seen.
#
# If you want to perform a custom report, just define your own callback
# function and invoke parse_porcelain() with it.
#
# The expected input format is slightly modified from raw `git blame
# -p`. Here is an example script for producing input:
@indygreg
indygreg / strptime_bench.py
Created March 15, 2012 00:15
strptime is slow
#!env python
from time import clock
from time import strptime
value = '2012-02-28 12:23:35Z'
fmt = '%Y-%m-%d %H:%M:%SZ'
total = 300000
start_time = clock()
@indygreg
indygreg / patch to browserid wiki
Created December 21, 2011 01:32
BrowserID Wiki Update
From ccb1c937714766e545753060946d872b57a1f2c7 Mon Sep 17 00:00:00 2001
From: Gregory Szorc <gps@mozilla.com>
Date: Tue, 20 Dec 2011 17:30:23 -0800
Subject: [PATCH] add link to lower-level details
---
How-BrowserID-Works.md | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/How-BrowserID-Works.md b/How-BrowserID-Works.md
@indygreg
indygreg / build.html
Created November 14, 2011 01:28
mozilla-central Programmatically Generated Makefile
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<title>Build System Information</title>
</head>
<body>
<h1>Build System Data</h1>
<p>This document contains information about the build system.</p>
@indygreg
indygreg / strtoll_bench.c
Created October 9, 2011 07:19
strtoll benchmark
#include <errno.h>
#include <stdio.h>
int main(int argc, const char **argv) {
if (argc != 3) {
printf("Usage: %s <integer> <iterations>\n", argv[0]);
return -1;
}
const char *input = argv[1];
@indygreg
indygreg / BeerList.txt
Created April 30, 2011 02:37
Beer List
Special/Hard to Find Bottles:
Firestone Walker 14th Anniversary Ale
Firestone Walker Reserve Porter
Unibrou (Trader Joe's) 2009 Vintage Ale
Unibrou (some kind of) Blonde Ale
Dogfish Head Hellhound DIPA x2
Bristol Old No 23 (multiple bottles) (2010 GABF gold medal barleywine winner)
More Regular Bottles:
@indygreg
indygreg / zeromq_blocking_receive_bug.cpp
Created November 28, 2010 02:47
ZeroMQ Blocking recv() Bug Reproduce
// 0MQ "data ready" + recv() block bug by Gregory Szorc <gregory.szorc@gmail.com>
//
// This file produces a bug where a 0MQ socket says it has a message
// available but the call to recv() blocks. This should not happen.
//
// Reproduce conditions:
//
// Definitely on Linux. Not on Windows
//
// For me, this reproduces on x86_64 Linux most of the time, but not always.