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 / index.html
Created April 17, 2019 08:00 — forked from jjgonecrypto/index.html
es6 proxy #jsbench #jsperf (http://jsbench.github.io/#531652a2edfa806a5014558bafe6eb0e) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>es6 proxy #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
question:
- https://github.com/winstonjs/winston/issues/1107
- https://github.com/winstonjs/winston/issues/1119
- https://github.com/winstonjs/winston/issues/1088
- https://github.com/winstonjs/winston/issues/1148
- https://github.com/winstonjs/winston/issues/1167
- https://github.com/winstonjs/winston/issues/1192
- https://github.com/winstonjs/winston/issues/1201
- https://github.com/winstonjs/winston/issues/1275
- https://github.com/winstonjs/winston/issues/1226

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@indexzero
indexzero / Makefile
Last active August 29, 2015 14:13 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.chord {
fill-opacity: .67;
; 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

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:

build

Clone and build Node for analysis:

$ git clone https://github.com/joyent/node.git
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1 v8_object_print=1"
$ export CXXFLAGS="-fno-omit-frame-pointer"
$ ./configure

So, to get something like /etc/rc.local you can use the custom SMF import facility. (See the source for more information about how this actually works.)

/opt is mounted out of zones/opt by default. You can create a directory /opt/custom/smf and populate it with SMF manifests. Any manifests you put in there will be imported by SmartOS when it boots. Below is an example SMF manifest that simply starts /opt/custom/bin/postboot, a self-explanatory shell script that you can use like /etc/rc.local.

Note that it would likely be better to customise and respin your own images, as putting a bunch of platform state in the zones pool undoes some of the benefits of the ramdisk platform architecture that SmartOS has.