Skip to content

Instantly share code, notes, and snippets.

View hardfire's full-sized avatar

अभिनाश (Avinash) hardfire

View GitHub Profile
mblarsen /
Last active November 28, 2016 04:22
A small shell command like `cd` that cd-s you back to project root.
# A small script that works like `cd` except that
# it keeps cd-ing until it reachs the project root
# project is defined by default as the directory
# that contains a .git sub-directory.
# Change this behavior like this:
# CDR_ROOT_ID=composer.json
danesparza / negroni-gorilla.go
Last active December 16, 2020 12:36
Negroni with Gorilla mux subrouter
package main
import (
staltz /
Last active May 18, 2024 05:17
The introduction to Reactive Programming you've been missing
juanje /
Last active November 30, 2023 19:29
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
branneman /
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js


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:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

hardfire /
Created September 1, 2012 16:59
create base files for a bonfire module
#! /bin/bash
# create base files for a bonfire module
u=$(tr '[a-z]' '[A-Z]' <<< ${1:0:1})
mkdir $1
mkdir "$1/assets"
mkdir "$1/config"