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
@AlexTalks
AlexTalks / vim-gui-server
Last active August 29, 2015 14:10
GVIM Wrapper! One TTY one GVIM window...
# GVIM Wrapper!
# Usage: gvim [option] [file...] open files, tabbed, in a shared window (default one per terminal)
# Options: (only one can be used)
# -d, --dir Open files in a window specific to the current working directory
# -n, --normal Execute command without server arguments
# -s, --server <name> Open files in the window named <name>
# --print Print command with full arguments
# --usage Print this message and exit
vim-gui-server() {
local PROGRAM="$1"
@durango
durango / hack.sh
Created March 31, 2012 17:58 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2267151/hack.sh | sh
#
// src/main.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <libspotify/api.h>
#define DEBUG 1
extern const uint8_t g_appkey[];
extern const size_t g_appkey_size;
@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)
@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);
}
})
@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
@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
@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>"
@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])
;
@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