Skip to content

Instantly share code, notes, and snippets.

View simonlindholm's full-sized avatar

Simon Lindholm simonlindholm

  • Stockholm, Sweden
View GitHub Profile
@simonlindholm
simonlindholm / gist:2878765
Created June 5, 2012 23:24
Firebug profiling code (for issue 1309)
/**
* Time execution of a piece of code, with a user-provided number 'iterations'
* of samples (>= 0), or if 'iterations' is null, just one.
*/
timeExecution = function(context, code, iterations)
{
var userGiven = true;
if (iterations === null)
{
userGiven = false;
From a4537a44618140589f8448281d6f7616bf9ff09c Mon Sep 17 00:00:00 2001
From: Simon Lindholm <simon.lindholm10@gmail.com>
Date: Wed, 22 May 2013 15:52:57 +0200
Subject: [PATCH] Add Debugger.prototype.makeDebuggeeValueFromGlobal
---
Debugger-makeDebuggeeValueFromGlobal-01.js | 31 ++++++++++++++++++++++++++++++
Debugger.cpp | 26 ++++++++++++++++++++++---
Debugger.h | 2 +-
3 files changed, 55 insertions(+), 4 deletions(-)
#!/usr/bin/env python
import sys
import os
import shutil
import argparse
if len(sys.argv) == 1:
program = os.path.basename(sys.argv[0])
print("Sample usage:")
print("$ git bisect start HEAD HEAD~10")
@simonlindholm
simonlindholm / gist:56331ad07b9854149297
Created July 30, 2014 23:20
Firebug issue 7585 testcase
<!DOCTYPE html>
<meta charset=utf-8>
Loaded with: <?= (isset($_POST['submit']) ? 'POST' : 'GET') ?><br>
Request number: <?php
session_start();
$req = (isset($_SESSION['reqid']) ? $_SESSION['reqid'] : 1);
$_SESSION['reqid'] = $req + 1;
echo $req;
?><br>
enum TryState {
TryEval = 1
};
int func() {
for (int state; ; ({break;}))
if (0)
out: break;
else
for (int i = 0; ; ++i)
@simonlindholm
simonlindholm / c.vim
Last active August 29, 2015 14:05
librcd syntax highlighting for vim
" Vim syntax file, modified from http://www.vim.org/scripts/script.php?script_id=3064.
" Put in ~/.vim/after/syntax/c.vim
"
" Language: Librcd C
" Maintainer: Simon Lindholm (simon.lindholm10@gmail.com)
" Last Change: 2014 Aug. 28
" Version: 0.1
"
" Changelog:
" 0.1 - initial version, modification from vimscript#3064
diff --git a/browser/devtools/styleinspector/rule-view.js b/browser/devtools/styleinspector/rule-view.js
index fb41f9a..e4ae10b 100644
--- a/browser/devtools/styleinspector/rule-view.js
+++ b/browser/devtools/styleinspector/rule-view.js
@@ -1813,17 +1813,17 @@ CssRuleView.prototype = {
* @param {Rule} aRule
* The Rule object we're editing.
* @constructor
*/
function RuleEditor(aRuleView, aRule) {
#!/bin/bash
cpp -m32 -P -nostdinc ttmath/ttmathuint.h | \
tr '\n' ' ' | \
sed 's/\s\+/ /g' | \
sed 's/\([^a-zA-Z0-9'\''_]\) /\1/g' | \
sed 's/ \([^a-zA-Z0-9'\''_%\($]\)/\1/g' | \
sed 's/^ //' | \
sed 's/\<return\>/R /g' | \
sed 's/\<operator\>/O/g' | \
sed 's/\<uint\>/U/g' | \
def parallel_invert(l, n):
'''Inverts all elements of a list modulo some number, using 3(n-1) modular multiplications and one inversion.'''
culm = l[:]
for i in xrange(len(l)-1):
culm[i+1] = (culm[i] * l[i+1]) % n
try:
inv = invert(culm[-1], n)
except ZeroDivisionError:
struct BloomishSet {
enum { TABLE_BITS = 4, COUNTER_BITS = 4, TEST_LIMIT = 8 };
uint32_t size;
uint64_t table[1 << TABLE_BITS];
BloomishSet() : size(0) {
memset(table, 0, sizeof table);
}
#ifdef DEBUG