Skip to content

Instantly share code, notes, and snippets.

View dhigginbotham's full-sized avatar
😸
happycat

David Higginbotham dhigginbotham

😸
happycat
View GitHub Profile
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active June 22, 2025 19:53
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@jacobrossi
jacobrossi / gist:a003bbc2987db506c5fc
Last active October 30, 2021 13:30
List of Touches - Pointer Events standard
//Code to create a list of touches called pointerList
var pointerList = []; //Array of all the pointers on the screen
window.addEventListener("pointerdown", updatePointer, true);
window.addEventListener("pointermove", updatePointer, true);
window.addEventListener("pointerup", remPointer, true);
window.addEventListener("pointercancel", remPointer, true);
function updatePointer(e) {
if(e.pointerType === "touch") {
@staltz
staltz / introrx.md
Last active June 28, 2025 13:44
The introduction to Reactive Programming you've been missing
@mbostock
mbostock / .block
Last active February 9, 2016 01:57
Merging Counties
license: gpl-3.0
if (!process.env.http_proxy) return;
var url = require('url');
var tunnel = require('tunnel');
var proxy = url.parse(process.env.http_proxy);
var tunnelingAgent = tunnel.httpsOverHttp({
proxy: {
host: proxy.hostname,
port: proxy.port
@tj
tj / example.js
Created July 31, 2013 18:48
console.api()
function params(fn) {
var str = fn.toString();
var sig = str.match(/\(([^)]*)\)/)[1];
if (!sig) return [];
return sig.split(', ');
}
console.api = function(obj){
console.log();
var proto = Object.getPrototypeOf(obj);
@brettz9
brettz9 / Array.prototype.slice.html
Last active February 18, 2021 06:54
(NOTE: This has been since improved to handle negative values at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice#Streamlining_cross-browser_behavior ); Polyfill for "fixing" IE's lack of support (IE < 9) for applying slice on host objects like NamedNodeMap, NodeList, and HTMLCollection (technically, s…
<!DOCTYPE html>
<body id="body" class="abc"><script src="Array.prototype.slice.js"></script><script src="testing-Array.prototype.slice.js"></script>
</body>

Readline example

readline = require "readline"
rl = readline.createInterface
  input:  process.stdin
  output: process.stdout

Example of named functions

You could use named functions to better read callbacks instead of deeply nested

@MrDHat
MrDHat / EventEmmiter.js
Last active December 19, 2015 15:48
A Pub/Sub API (Originally written for Gaia)
this.EventEmmiter = (function() {
var events = {};
var UUID = -1;
// Function to publish/trigger events
function trigger(evt, args) {
if (!events[evt]) {
return false;
#define HTTP_STATUS_100 "100 Continue"
#define HTTP_STATUS_101 "101 Switching Protocols"
#define HTTP_STATUS_102 "102 Processing"
#define HTTP_STATUS_200 "200 OK"
#define HTTP_STATUS_201 "201 Created"
#define HTTP_STATUS_202 "202 Accepted"
#define HTTP_STATUS_203 "203 Non-Authoritative Information"
#define HTTP_STATUS_204 "204 No Content"
#define HTTP_STATUS_205 "205 Reset Content"
#define HTTP_STATUS_206 "206 Partial Content"