Skip to content

Instantly share code, notes, and snippets.

@kumavis
kumavis / constants.js
Created June 4, 2013 08:03
This is just copy-pasta.
module.exports = {
O_RDONLY: 0,
O_WRONLY: 1,
O_RDWR: 2,
S_IFMT: 61440,
S_IFREG: 32768,
S_IFDIR: 16384,
S_IFCHR: 8192,
S_IFBLK: 24576,
S_IFIFO: 4096,
@kumavis
kumavis / dns.js
Created June 4, 2013 07:57
This is just a copy-pasta piece of junk, I have not tested it.
// ===========================================================
// ===========================================================
// THIS IS COPY-PASTE-HACK. THIS IS NOT KNOWN TO ACTUALLY WORK
// ===========================================================
// ===========================================================
module.exports = {
lookup: function (domain, family, callback) {
// parse arguments
if (arguments.length === 2) {
@kumavis
kumavis / gist:5703920
Last active December 18, 2015 01:29
An attempt at browserifying npm

This project:

  1. is a case-study for browserifying anything
  2. part of a dream to create virtual Node.js development environment
  3. likely a major time-sink!

starting out:

mkdir browser-npm && cd browser-npm
npm install npm
@kumavis
kumavis / gist:5703360
Last active December 18, 2015 01:19
Notes for making "black_magic" for node-browserify

any node package in the browser

browserify makes this possible for many modules, but the browser is a different environment (ex: no file system access) so we're going to need a few things if we want to run just anything:

1- browser versions of the native modules

  • many are detailed here
@kumavis
kumavis / gist:5691536
Last active December 17, 2015 23:48
browser-resolve 1.0.1 fails to locate package.json

from browser-resolve 1.0.1 index.js

// paths is mutated
// load shims from first package.json file found
function load_shims(paths, cb) {
    // identify if our file should be replaced per the browser field
    // original filename|id -> replacement
    var shims = {};

 (function next() {
@kumavis
kumavis / gist:5681818
Created May 30, 2013 22:38
browserify dependencies
[kumavis:...opment/Node/node-browserify]$ npm list                                                                          
npm WARN unmet dependency /Users/kumavis/Dropbox/Development/Node/node-browserify/node_modules/tap/node_modules/glob requires inherits@'1' but will load
npm WARN unmet dependency /Users/kumavis/Dropbox/Development/Node/node-browserify/node_modules/tap/node_modules/inherits,
npm WARN unmet dependency which is version 2.0.0
[email protected] /Users/kumavis/Dropbox/Development/Node/node-browserify
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
@kumavis
kumavis / gist:5681595
Last active December 17, 2015 22:19
Quick and dirty grab of the node fs attributes used by node-browserify and dependencies. Generated by cloning the repo, npm install, project-wide search for "fs.", grabbing all the words following the period, forming them into a list of strings and dropping them into an irb sesh, calling uniq, sorting, then joining with a newline. Finally, manua…

filesystem-browserify implements: 7 attributes

createReadStream
createWriteStream
readFile
readdir
rename
unlink
writeFile
@kumavis
kumavis / gist:5676173
Created May 30, 2013 07:05
npm ERR! peerinvalid The package voxel-engine does not satisfy its siblings' peerDependencies requirements!

fresh clone of voxel-gist [https://github.com/maxogden/voxel-gist]

[kumavis:...Development/Node/voxel-gist]$ npm install

npm http GET https://registry.npmjs.org/ecstatic/0.3.2
npm http GET https://registry.npmjs.org/jsonp/0.0.3
npm http GET https://registry.npmjs.org/javascript-editor/0.0.1
npm http GET https://registry.npmjs.org/snuggie/0.0.4
npm http GET https://registry.npmjs.org/uglify-js/2.2.3
@kumavis
kumavis / error_forwarding.coffee
Last active December 17, 2015 15:29
Ember error phone home
# ===
# = This helper sends client errors home to the server for logging
# ===
# TODO: include some client diagnostics, browser type etc
# Grab standard error callback
_super = Ember.Logger.error
# Overwrite error callback to phone home
Ember.Logger.error = (message) ->
@kumavis
kumavis / gist:5603550
Created May 18, 2013 07:13
「ご存知の通り」の別の言い方
御承知置きの通り
お聞き入れの通り
お聞き届けの通り
御領承の通り
御応諾の通り
御承引の通り