Skip to content

Instantly share code, notes, and snippets.

@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@branneman
branneman / better-nodejs-require-paths.md
Last active April 11, 2025 10:39
Better local require() paths for Node.js

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:

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

Those suck for maintenance and they're ugly.

Possible solutions

@hijonathan
hijonathan / wercker.yml
Last active December 30, 2015 11:39
Brunch + Divshot Wercker config.
box: wercker/nodejs
# Brunch's production build can take a while and doesn't output
# anything by default. Either set a long timeout like this one, or
# run it in debug mode to output logs.
no-response-timeout: 10
# Build definition
build:
# The steps that will be executed on build
@dmitshur
dmitshur / gist:6927554
Last active December 29, 2024 12:06
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@rapha
rapha / word_count.ml
Created January 1, 2010 06:47
word count in OCaml
open Batteries
let rec files path =
if Shell.is_directory path then
path |> Shell.readdir |> Array.enum |> map ((^) (path ^ "/")) |> map files |> Enum.flatten
else
Enum.singleton path
let read_file filename =
File.with_file_in filename IO.read_all