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 / ISC.md
Created April 13, 2014 21:00
ISC vs. MIT

Copyright (c) 4-digit year, Company or Person's Name

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Source: http://opensource.org/licenses/ISC

; CouchDB Config
; Drop in PREFIX/local.d/npmjs.ini
[couch_httpd_auth]
public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev
users_db_public = true
[httpd]
secure_rewrites = false
@indexzero
indexzero / safe-parse.js
Created March 4, 2014 08:53
Simple and safe URL parsing which allows for some special characters.
function safeParse (str) {
var whack = str.indexOf('://'),
at = str.lastIndexOf('@'),
auth;
str = str.replace(/\/$/, '');
auth = str.substring(whack + 3, at);
return {
url: str.replace(auth + '@', ''),
auth: auth
@indexzero
indexzero / proxy-rewriting.js
Created February 19, 2014 06:44
URL to host rewrite proxying with node-http-proxy
var httpProxy = require('http-proxy')
var proxy = httpProxy.createProxy();
var fulltld = 'my-own-domain.com';
var options = {
'/first-target': 'first-target',
'/second-target': 'second-target'
}

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@indexzero
indexzero / remote-download.js
Created January 3, 2014 02:59
A simple remote download script for pkgcloud and rackspace
var fs = require('fs'),
zlib = require('zlib'),
tar = require('tar'),
pkgcloud = require('pkgcloud'),
argv = require('optimist').argv;
var client = pkgcloud.storage.createClient({
provider: argv.p,
username: argv.u,
apiKey: argv.k
@indexzero
indexzero / godot-what-if.js
Last active January 1, 2016 19:29
Experimental (and not implemented godot) syntax with a stronger focus on native stream APIs
var g = require('godot');
//
// Reactor server which will email `user@host.com`
// whenever any service matching /.*\/health\/heartbeat/
// fails to check in after 60 seconds.
//
g.createServer({
//
// Defaults to UDP
@indexzero
indexzero / answers.md
Created December 30, 2013 22:32
Responses to Javascript Survey

1. Have you used strict mode in your code? Have you used it in debug build or in release build?

I do not actively use the 'use strict' directive, but I have written code in projects that do. I've never had an error in the code I write once enabling 'use strict'.

2. What, according to you, are the problems of using strict mode in code?

I don't use strict mode enough to know it's problems

3. Do you typically declare variables within block scope, or mostly declare variables in function scope?

@indexzero
indexzero / network-interfaces.js
Created December 2, 2013 09:25
node lied to me. Maybe?
$ node
> var os = require('os')
undefined
> os.networkInterfaces()
{ lo0:
[ { address: 'fe80::1',
family: 'IPv6',
internal: true },
{ address: '127.0.0.1',
family: 'IPv4',
@indexzero
indexzero / ab.out
Created December 1, 2013 22:00
Testing out bud with @indutny
$ ab -n 1000 -c 10 https://127.0.0.1:1443
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests