Skip to content

Instantly share code, notes, and snippets.

View jwerle's full-sized avatar
🔨
Working on @socketsupply/socket

Joseph Werle jwerle

🔨
Working on @socketsupply/socket
View GitHub Profile
@juliangruber
juliangruber / README.md
Last active March 24, 2021 02:00
lightweight node-websocketd

node-websocketd

A lightweight node port of websocketd, originally written in go.

Usage

node-websocketd --port=8080 ./count.sh
@juliangruber
juliangruber / gist:7356251
Last active May 5, 2021 17:53
localhost subdomains on osx

First, install dnsmasq using brew:

$ brew update
$ brew install dnsmasq

Then create your configuration

@juliangruber
juliangruber / gist:7337388
Created November 6, 2013 14:57
browserify bundling tests
# simple bundle
$ time browserify --debug lib/boot/index.js | wc -c
1397809
real 0m1.726s
user 0m1.540s
sys 0m0.139s
# bundle without node_modules
@juliangruber
juliangruber / gist:5796306
Created June 17, 2013 11:44
that's how small minimal browserify bundles are. uncompressed: 647B. compressed: 433B. Fuck yeah, JavaScript!
;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
// your code
},{}]},{},[1])
;
@zivester
zivester / gist:5578675
Created May 14, 2013 19:19
[].join()
$('body').append([
"<div class='loading-screen' style='z-index:1005'>",
"<div class='loading-container'>",
"<div class='text'>Loading " + item.name + " (" + item.id + ")",
"<div class='progress progress-striped active' style='width: 100%'>",
<div class='bar' style='width: 100%;'></div>",
"</div>",
"</div>",
"</div>",
"</div>"
@chrisdickinson
chrisdickinson / client.js
Last active December 15, 2015 16:38
based on the newly released `git-list-pack` stream; this is an example of cloning repos from the browser. use `browserify client.js > bundle.js` to compile.
var shoe = require('shoe')
, fetch = require('git-fetch-pack')
, unpack = require('git-list-pack')
, through = require('through')
, Buffer = require('buffer').Buffer
// make a websocket connection to the
// server.
var conn = shoe('/git')
, client
@techwraith
techwraith / index.js
Created February 8, 2013 02:55
voxel.js game
var createGame = require('voxel-engine')
function sphereWorld(x, y,z ) {
// return the number of the material you want to show up
// at the current x, y, z position.
// the numbers refer to the games materials array.
// 0 is air
if (x*x + y*y + z*z > 15*15) return 0
// 3 is dirt
return 3
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

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:

@isaacs
isaacs / s.js
Created January 17, 2013 19:27
var AsyncCache = require('async-cache')
var fs = require('fs')
var stats = new AsyncCache({
max: 100,
maxAge: 1000,
load: function (filePath, cb) {
fs.stat(filePath, cb);
}
})
@isaacs
isaacs / r.js
Created January 13, 2013 02:03
var Readable = require('stream').Readable;
var r = new Readable({
lowWaterMark: 3,
highWaterMark: 10
});
var calls = 0;
r._read = function (n, cb) {
console.log("_read", this._readableState.length,
this._readableState.lowWaterMark,
this._readableState.highWaterMark)