Skip to content

Instantly share code, notes, and snippets.

View r4j4h's full-sized avatar

Jasmine Hegman r4j4h

View GitHub Profile
@leetreveil
leetreveil / mmfolderscan.js
Created May 19, 2011 19:32
node-musicmetadata folder scan
var fs = require('fs'),
walk = require('walk'),
path = require('path'),
mm = require('musicmetadata');
walker = walk.walk('/Users/leetreveil/Music/Mine', { followLinks : false });
walker.on('file', function(root, fileStats, next) {
if (/^.*\.(mp3|m4a|flac|ogg)/.test(fileStats.name)) {
var fullPath = path.join(root, fileStats.name);
@penguinbroker
penguinbroker / gist:1378258
Created November 19, 2011 01:15
Paper.js hit test
hitTool = new paper.Tool();
hitTool.activate();
hitTool.onMouseDown = function (event) {
hitOptions = {
segments: true,
stroke: true,
fill: true,
tolerance: 5
};
hitResult = paper.project.hitTest(event.point, hitOptions);
@mattbaker
mattbaker / README
Created December 22, 2011 06:02
SVG to PNG render with Node and D3.js
This example expects to have d3.min.js and d3.layout.min.js in the same directory as pie.js and pie_serv.js.
Run with node pie_serv.js
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@bengfarrell
bengfarrell / randomcoords.cpp
Last active April 17, 2020 16:30
Random Coordinates C++ Node.JS AddOn
#include <node.h>
#include <v8.h>
#include <stdio.h>
#include <stdlib.h>
using namespace v8;
Handle<Value> getRandomCoords2D(const Arguments& args) {
HandleScope scope;
@nathggns
nathggns / errorception.js
Created September 27, 2013 11:10
Wrap Errorception to provide stack traces in some browsers
window.onerror = (function(old) {
return function() {
var args = [].slice.call(arguments);
for (var i = 0, l = arguments.length; i < l; i++) {
if (args[i] instanceof Error) {
window._errs.push(args[i]);
}
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@jrideout
jrideout / README.md
Created October 29, 2013 19:11 — forked from mbostock/.block

A quick visual reference to every ColorBrewer scale; colors by Cynthia Brewer. Available in CSS and JS format. Click on a palette to log the constituent colors in hexadecimal RGB to the console.

@westonplatter
westonplatter / HomeController.js
Created November 20, 2013 07:16
stream MP3 through SailsJS framework
/**
* HomeController
*
* @module :: Controller
* @description :: Contains logic for handling requests.
*/
module.exports = {
index: function (req,res) {

How @extend Works

@akhleung is working on hcatlin/libsass and was wondering how @extend is implemented in the Ruby implementation of Sass. Rather than just tell him, I thought I'd write up a public document about it so anyone who's porting Sass or is just curious about how it works can see.

Note that this explanation is simplified in numerous ways. It's intended to explain the most complex parts of a basic correct @extend transformation, but it leaves out numerous details that will be important if full Sass compatibility