Skip to content

Instantly share code, notes, and snippets.

@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
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

@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@FiloSottile
FiloSottile / browser_request
Created December 12, 2013 23:20
Analysis of the new GMail image proxy
{
"accept-language": "en-US,en;q=0.8,it-IT;q=0.6,it;q=0.4",
"accept-encoding": "gzip,deflate,sdch",
"cache-control": "max-age=0",
"connection": "keep-alive",
"accept": "image/webp,*/*;q=0.8",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36",
"host": "filosottile.info",
"if-modified-since": "Wed, 31 Oct 2012 23:52:07 GMT"
}
@michaelcox
michaelcox / SpecRunner.js
Last active January 11, 2024 06:05
Browser Unit Testing with Backbone Mocha Chai and RequireJS
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@ktheory
ktheory / dd.log
Last active November 10, 2023 23:41
EC2 EBS-SSD vs instance-store performance on an EBS-optimized m3.2xlarge
# /tmp/test = EBS-SSD
# /mnt/test = instance-store
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 3.26957 s, 82.1 MB/s
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test
256+0 records in
256+0 records out
@RobertAudi
RobertAudi / moc-on-osx.md
Last active September 30, 2023 19:54
This is a walkthrough on how to install the MOC command-line music player on OS X. The procedure was tested in Mountain Lion.

MOC on OS X

I waited for years for a Homebrew formula for MOC. I finally found one today, but it didn't work for me. So I decided to try to compile it from source.

Requirements

Here is a list of requirements, taken directly from the MOC README:

@ms-tg
ms-tg / jdk8_optional_monad_laws.java
Created November 11, 2013 21:14
Does JDK8's Optional class satisfy the Monad laws? Yes, it does.
/**
* ```
* Does JDK8's Optional class satisfy the Monad laws?
* =================================================
* 1. Left identity: true
* 2. Right identity: true
* 3. Associativity: true
*
* Yes, it does.
* ```
@lecram
lecram / escher.py
Last active August 27, 2021 07:05
This is a toy one-file application to manage persistent key-value string data. The file is *both* the application and its data. When you run any of the commands described in `escher.py --help`, the file will be executed and, after data change, it will rewrite itself with updated data. You can copy the file with whatever name to create multiple d…
#! /usr/bin/env python
"""{escher} -- one-file key-value storage.
What?
This is a toy application to manage persistent key-value string data.
The file {escher} is *both* the application and its data.
When you run any of the commands below, the file will be executed and,
after data change, it will rewrite itself with updated data.
You can copy the file with whatever name to create multiple datasets.
@willscott
willscott / analytics.conf
Created November 12, 2016 18:49
Google Analytics Proxy
location = /analytics.js {
proxy_hide_header Alt-Svc;
resolver 8.8.8.8 ipv6=off;
proxy_pass https://www.google-analytics.com/analytics.js;
break;
}
location = /analytics {
access_by_lua_block {
ngx.req.read_body()
local body = ngx.req.get_body_data()