Skip to content

Instantly share code, notes, and snippets.

View sym3tri's full-sized avatar
🌴
On vacation

Ed Rooth sym3tri

🌴
On vacation
View GitHub Profile
@sym3tri
sym3tri / viewbox.js
Created January 25, 2013 22:14
A simple example of auto-resize using svg viewBox.
var svg = d3.select('#container').append('svg')
.attr({
viewBox: '0 0 1000 1000',
});
svg.append('rect')
.attr({
width: '1000',
height: '1000'
});
@sym3tri
sym3tri / memory-attachment.go
Last active June 10, 2016 05:06
easily email an attachment without reading from disk
package main
import (
"fmt"
"bytes"
"io/ioutil"
"github.com/mailgun/mailgun-go"
)
func main() {

Keybase proof

I hereby claim:

  • I am sym3tri on github.
  • I am edrooth (https://keybase.io/edrooth) on keybase.
  • I have a public key whose fingerprint is A32D 1972 3F68 A490 7BFE 326F 4C46 F707 5A64 CE83

To claim this, I am signing this object:

@sym3tri
sym3tri / spotify-missing-hiphop.md
Last active March 6, 2017 00:02
90s hip hop albums missing from Spotify
@sym3tri
sym3tri / GH-WS-Ignore
Created April 6, 2012 19:42
Bookmarklet to quickly ignore whitespace in github diffs
javascript:(function() { window.location.href += '?w=1';})();
@sym3tri
sym3tri / Japan.md
Last active October 1, 2018 11:51
So you're visiting Japan?
@sym3tri
sym3tri / var-hoisting.js
Created February 26, 2015 22:54
example of how javascript hoisting works
function foo() {
var myvar = 'my value';
(function() {
alert(myvar); // undefined
var myvar = 'local value';
})();
}
function mixin(receiver, supplier) {
Object.keys(supplier).forEach(function(property) {
Object.defineProperty(receiver, property, Object.getOwnPropertyDescriptor(supplier, property));
});
}
var name = 'Ed',
supplier = {
get name() {
return name;
@sym3tri
sym3tri / proto.js
Last active January 10, 2019 09:14
Explanation of prototypes
// http://dailyjs.com/2012/11/26/js101-proto/
var assert = require('assert');
function User() {
}
var user = new User();
assert.equal(user.__proto__, User.prototype);
@sym3tri
sym3tri / function.js
Created November 28, 2012 17:57
JS function behind the scenes
// Every time you define a function it's as if all this happens behind the scenes...
function foo() {
// var arguments = new array-like object corresponding to the function arguments
// foo.length = number of parameters in function definition (different from arguments.length);
// foo.name = 'foo';
// foo.prototype = {};
// foo.constructor = Function;
//// (only if no explicit return statement exists and is not invoked with 'new' operator)