Skip to content

Instantly share code, notes, and snippets.

View indexzero's full-sized avatar
🌎
Always bet on Open Source

Charlie Robbins indexzero

🌎
Always bet on Open Source
View GitHub Profile
@indexzero
indexzero / hrtime-uuid.js
Created December 29, 2014 21:16
process.hrtime vs uuid.v1() microbenchmark
var uuid = require('uuid'),
accounting = require('accounting'),
benchmark = require('benchmark');
(new benchmark.Suite())
.add('process.hrtime', function () {
var foo = process.hrtime().join('');
foo += '-0';
})
.add('uuid', function () {
@indexzero
indexzero / lint-fail.log
Created December 8, 2014 17:39
http-server failing lint ... why?
$ git pull Jinkwon master
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From https://github.com/Jinkwon/http-server
* branch master -> FETCH_HEAD
Updating 4407db1..c5839f8
Fast-forward
.gitignore | 2 ++
@indexzero
indexzero / show-rating.js
Created October 23, 2014 04:02
Show titles you've rated with only a specific rating in Netflix
function showRating (target) {
$('#ratingHistorySection .retable li').each(function (el) {
var child = $(this).find('.rating .starbar');
var rating = $(child).attr('data-your-rating');
if (rating != target) {
$(this).hide();
}
});
}
@indexzero
indexzero / chaos.md
Last active August 29, 2015 14:06
Javascript, objects, object keys, named functions, and chaos

A directed event graph

Lets suppose that instead of wanting to trigger a linear set of functions such as the core Node.js EventEmitter, you wanted to be able to trigger events as a (potentially cyclic) directed graph.

Scenario 1. A causes B & C to fire

A
├─B
│
└────C
@indexzero
indexzero / targs.js
Created September 6, 2014 04:41
Some silly arguments parsing experiment thingy
var assert = require('assert');
var targs = module.exports = function (args, names) {
var types = Object.keys(names);
return args.reduce(function (ret, arg) {
var type = typeof arg;
if (~types.indexOf(type)) {
ret[names[type]] = arg;
}
@indexzero
indexzero / index.html
Created May 14, 2014 04:37
All rappers everything
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>The Largest Vocabulary in Hip hop</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
@indexzero
indexzero / README.md
Last active August 29, 2015 14:01
A CouchDB view for checking which modules use the existing github "user/repo" syntax

A CouchDB view for checking which modules use the existing github "user/repo" syntax

Usage

  1. Copy / paste design-doc.json into a new document in your registry
  2. Visit http://localhost:5984/registry/_design/synxtax/_view/git?startkey=["latest"]
  3. Output on May 9th, 2014
{"rows":[
@indexzero
indexzero / continents.json
Last active March 26, 2022 21:21
Where in the world is a good JSON mapping of all continents?
{
"Afghanistan": "Asia",
"Aland Islands": "Europe",
"Albania": "Europe",
"Algeria": "Africa",
"Andorra": "Europe",
"Angola": "Africa",
"Anguilla": "North America",
"Antigua and Barbuda": "North America",
"Argentina": "South America",
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.chord {
fill-opacity: .67;
@indexzero
indexzero / cron.md
Created April 17, 2014 05:40
The best explanation of a crontab I've ever seen
Why has cron this always been so confusing until now?
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)