Skip to content

Instantly share code, notes, and snippets.

@micahcatlin
micahcatlin / gist:3961866
Created October 26, 2012 22:11
Fragment for measuring fps, heap size on Chrome
function() {
var lastHeapSize = null;
var lastFrameTime = null;
var runGame = function() {
requestAnimationFrame(runGame);
var frameTime = window.performance.now();
var heapSize = window.performance.memory.usedJSHeapSize;
@ndarville
ndarville / business-models.md
Last active May 29, 2026 04:06
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@jjgod
jjgod / CCacheMacNinja.md
Last active March 24, 2026 08:31
Using ccache for Mac builds

Introduction

ccache is a compiler cache. It speeds up recompilation of C/C++ code by caching previous compilations and detecting when the same compilation is being done again. This often results in a significant speedup in common compilations, especially when switching between branches. This page is about using ccache on Mac with clang and ninja build system. If you want to use Xcode, please refer to the old CCacheMac page.

In order to use ccache with clang, you need to use the current git HEAD, since the most recent version (3.1.9) doesn't contain the patch needed for using chromium style plugin.

Installation

To install ccache with [homebrew](http://mxcl.

@dguido
dguido / ref_fuzz5.js
Created March 7, 2013 01:05
Heap spray code snippet from lcamtuf's ref_fuzz5 JavaScript DOM fuzzer
function heap_spray() {
if (MEGS == 0 || R(2) == 0) return;
if (!spray_str) {
var spray_str = "ABCDABCD";
for (var i=0;i<21;i++) spray_str += spray_str; /* 16M */
}
window.name = Math.random() + spray_str + Math.random();
@inexorabletash
inexorabletash / idbkeyrange_forprefix.js
Last active May 20, 2024 02:54
Helper for creating an IDBKeyRange for all keys with a given prefix
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// Basic p(r)olyfill for proposed feature
// This defines no successor of empty arrays, so the range for prefix
// [] or [[],[]] has no upper bound.
// An alternate definition would preclude adding additional nesting,
// so the range for prefix [] would have upper bound [[]] and the
// range for prefix [[], []] would have upper bound [[], [[]]].
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active May 30, 2026 13:44
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@toolmantim
toolmantim / Makefile
Last active July 11, 2025 20:15
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
@vjeux
vjeux / ReactPerformance
Created March 10, 2014 20:47
React Performance
# Basic
Initial rendering takes ~25ms
Delete first takes ~30ms
Delete last takes ~15ms
Add `background: red` to the second element and delete the first, you'll see that the second element is still red. What happened is that everything moved around. The reason is that React doesn’t do the matching properly.
http://jsfiddle.net/vjeux/tXfDU/
@wycats
wycats / cargo.md
Last active August 29, 2015 13:57
Cargo Status Update - Week of March 17, 2014

Our major goal this week was cleanup: we're planning on moving our current work to the rust-lang repository in the next week or two, so cleanup was the order of the week.

Command Structure

Because Cargo uses the same design as git (many plumbing commands that are used by a smaller number of high-level porcelain commands), getting a standard way to write commands with limited boilerplate was a high priority to get done before we wrote too many commands. We wrote the first few commands by hand, then extracted out some useful abstractions.

A few weeks ago, I wrote a library named Hammer.rs that allows you to decode command-line flags into a struct.

extern crate hammer;