Skip to content

Instantly share code, notes, and snippets.

@anonymelon
anonymelon / better-nodejs-require-paths.md
Created January 5, 2018 06:47 — forked from branneman/better-nodejs-require-paths.md
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:

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

Those suck for maintenance and they're ugly.

Possible solutions

@anonymelon
anonymelon / README.md
Last active February 28, 2017 08:51 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@anonymelon
anonymelon / .rubocop.yml
Created August 3, 2015 13:56
My rubocop config
AllCops:
Include:
- "**/*.gemspec"
- "**/*.podspec"
- "**/*.jbuilder"
- "**/*.rake"
- "**/*.opal"
- "**/Gemfile"
- "**/Rakefile"
- "**/Capfile"
{
"cmd": ["/Users/Jeremy/.nvm/v0.10.36/bin/node", "$file"],
"selector": "source.js",
"windows" : {
"shell": true
}
}
{
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"command": "goto_definition",
"translate_tabs_to_spaces": true,
"ensure_newline_at_eof_on_save": true,
"trim_trailing_white_space_on_save": true,
"fallback_encoding": "UTF-8",
"default_line_ending": "unix",
"shift_tab_unindent": true,
"font_size": 13,

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
# Sample Configuration File for Privoxy 3.0.21
#
# $Id: config,v 1.104 2013/03/07 14:11:51 fabiankeil Exp $
#
# Copyright (C) 2001-2013 Privoxy Developers http://www.privoxy.org/
#
####################################################################
# #
# Table of Contents #
# #
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
@anonymelon
anonymelon / SublimeText3Tips.md
Last active August 29, 2015 14:11
Sublime Text3

Sublime Text3 Tips

Plugins

  • [knockdown][1]
  • [git][2]
  • [Emmet][3]

Keyboard shortcuts

  • ctrl+x cut one row