Skip to content

Instantly share code, notes, and snippets.

Nicolas Chambrier naholyr

Block or report user

Report or block naholyr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
stevemao /
Last active Aug 12, 2019 — forked from sindresorhus/
Publish node module
# npm publish with goodies
# prerequisites:
# `npm install -g trash conventional-recommended-bump conventional-changelog conventional-github-releaser conventional-commits-detector json`
# `np` with optional argument `patch`/`minor`/`major`/`<version>`
# defaults to conventional-recommended-bump
# and optional argument preset `angular`/ `jquery` ...
# defaults to conventional-commits-detector
np() {
travis status --no-interactive &&
trash node_modules &>/dev/null;
naholyr / Makefile
Last active Mar 6, 2018
browserify-friendly Makefile
View Makefile
# Main entry point
SOURCE = src/app.js
# The dependencies (other than node_modules/**)
LIBS = $(shell ls src/lib/*.js src/components/*.js)
# The target
TARGET = build/app.js
# Compilation flags
constantology / process.logger.js
Created Jul 24, 2014
using node's process to emit events to log stuff from anywhere
View process.logger.js
// use like this:
// process.emit( 'app:log', module, arg1, arg2, ..., argN );
var Module = require('module');
function logConsole(method, module) {
var args = [(new Date()).toJSON(), method];
var index = 1;
if (module instanceof Module) {
oncletom / convert-helpers.js
Last active Aug 29, 2015
XML Stream Update
View convert-helpers.js
'use strict';
var STYLE_ATTRIBUTE = 'text-style-name';
var styleMatches = function (item, styleName) {
if (!item || item.attributes === undefined || item.attributes[STYLE_ATTRIBUTE] === undefined) {
return false;
return item.attributes[STYLE_ATTRIBUTE].match(styleName);
ricardobeat / node-0.8.20-hangup.js
Created Feb 21, 2013
Silence socket hangup errors.
View node-0.8.20-hangup.js
function hangups (req, res, next){
var reqd = domain.create()
reqd.on('error', function (error) {
if (error.code !== 'ECONNRESET') console.error(error, req.url)

In addition to awesome docs #228, Bower deserves a proper logo. See below for sketches. I'm curious if you think any of these are worth me putting more effort into.

Take a look at Yeoman right now.

Screen Shot 2013-02-19 at 4 43 10 PM

The other two entities have awesome logos. Bower's got to represent.

View time-require.patch
diff --git a/lib/module.js b/lib/module.js
index 6130394..80559f4 100644
--- a/lib/module.js
+++ b/lib/module.js
@@ -25,6 +25,7 @@ var runInThisContext = Script.runInThisContext;
var runInNewContext = Script.runInNewContext;
var assert = require('assert').ok;
+var timeRequire = +process.env.NODE_TIME_REQUIRE;
View range-error-ftw.js
var a = [];
a[Math.pow(2, 32) - 2] = "max index"; // highest non-expando indexed property
console.log(a.length === Math.pow(2, 32) - 1); // true
try {
a.push("whoa", "EVEN MOAR WHOA");
} catch (e) {
console.log(e instanceof RangeError); // true
naholyr /
Created Nov 22, 2012
Using "hub" to automatically push & PR


Part of my personal shortcuts for the usual pull-request-based workflow.


Given you have an "upstream" repository you need to work on:

  1. Fork it
  2. Clone your fork locally (repo "origin")
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

You can’t perform that action at this time.