Skip to content

Instantly share code, notes, and snippets.

View mutability.js
var x = 4;
function change(v) {
v = v + 9;
}
change(x);
console.log(x); // 4
@harthur
harthur / mc-github.md
Created May 5, 2011
Stuff to do for a mozilla-central on github
View mc-github.md
  • have a README.md
  • pull request with bug number will upload patch to bug
@harthur
harthur / gist:992175
Created May 25, 2011
repos from the first Silicon Valley Hack and Tell meetup
View gist:992175
View gist:1076306
var async = require("async"),
github = new (require("github").GitHubApi)(),
users = github.getUserApi(),
names = require("./femalenames").slice(0, 50),
cradle = require("cradle"),
fs = require("fs");
var toFollow = [];
function dateAgo(daysAgo) {
@harthur
harthur / lexicon.js
Created Sep 20, 2011
Problem require'ing a huge module in CouchDB CommonJS
View lexicon.js
module.exports = {
"Ranavan": [
"NNP"
],
"fawn": [
"NN"
],
"pro-Soviet": [
"JJ"
],
View tweets.js
var ntwitter = require("ntwitter"),
growl = require("growl");
var twitter = new ntwitter({
// fill in w/ keys from https://dev.twitter.com/apps/new
consumer_key: null,
consumer_secret: null,
access_token_key: null,
access_token_secret: null
});
@harthur
harthur / scratchpad.js
Created Mar 22, 2012 — forked from paulrouget/scratchpad.js
Firefox Magnifier
View scratchpad.js
/*
TODO:
- zoom level menu
- need to find a way to re-start the update
- add color tools
- integrate better in Firefox
- crosshair has a 1px offset
*/
@harthur
harthur / gist:2310787
Created Apr 5, 2012
`brew doctor` output
View gist:2310787
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/opt/local/bin/icu-config
@harthur
harthur / renderedfont.js
Created Apr 18, 2012
Get rendered font-family
View renderedfont.js
function getRenderedFontFamily(fontFamily) {
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
let families = fontFamily.split(/\s*,\s*/);
for each (let family in families) {
if (family == 'inherit') {
return family;
}
@harthur
harthur / fetchgrams.js
Created May 2, 2012
Download pictures with cat tag from Instagram
View fetchgrams.js
var http = require("http"),
url = require("url"),
fs = require("fs"),
async = require("async"),
Instagram = require('instagram-node-lib');
Instagram.set('client_id', /* client key */);
Instagram.set('client_secret', /* client secret */);
fetchTag('cat', 400);