Skip to content

Instantly share code, notes, and snippets.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@rkJun
rkJun / Back_to_the_Mac_20120805.css
Last active October 9, 2015 10:37
Safari, Google Chrome Font Style Sheet for Mac
//# Link (출처) : http://macnews.tistory.com/162
//# Safari/Google Chrome Korean Font Style Sheet for OS X Mountain Lion
//#
//# Google Chrome : ~/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css
@font-face {
font-family: AppleGothic;
src: local("Apple SD Gothic Neo"),
local("Nanum Gothic");
}
@remcoder
remcoder / typescript.sublime-build
Created October 1, 2012 19:48
Sublime Text 2 build system for Typescript
{
"selector": "source.ts",
"cmd": ["tsc", "$file"],
"file_regex": "^(.+?) \\((\\d+),(\\d+)\\)(: .+)$",
"line_regex": "\\((\\d+),(\\d+)\\)",
"osx": {
"path": "/usr/local/bin:/opt/local/bin"
@mytory
mytory / gist:6238053
Created August 15, 2013 03:33
my .bash_profile
export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\n\[\e[0m\]$ '
export PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH"
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
export EDITOR=nano
PATH=$PATH:/usr/local/mysql/bin
alias ls='gls --color=auto -F'
source .git-completion.bash
@alanhamlett
alanhamlett / api.py
Last active October 21, 2024 14:30
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort
@gmccreight
gmccreight / master.vim
Last active August 26, 2024 17:49
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@branneman
branneman / better-nodejs-require-paths.md
Last active October 18, 2024 20:29
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

import code
from myapp import app
env = {
'app': app,
}
with app.app_context():
code.interact(local=env)
@gmr
gmr / consul.lua
Created July 14, 2014 17:03
Dynamic Nginx upstream nodes using Consul
module("resty.consul", package.seeall)
_VERSION = '0.1.0'
function service_nodes(service)
local http = require "resty.http"
local json = require "cjson"
local hc = http:new()
local upstream = ""