start new:
tmux
start new with session name:
tmux new -s myname
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
$(function () { | |
"use strict"; | |
// for better performance - to avoid searching in DOM | |
var content = $('#content'); | |
var input = $('#input'); | |
var status = $('#status'); | |
// my color assigned by the server | |
var myColor = false; |
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |
Sometimes you want to have a subdirectory on the master
branch be the root directory of a repository’s gh-pages
branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master
branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist
.
Remove the dist
directory from the project’s .gitignore
file (it’s ignored by default by Yeoman).
I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).
In Vim I have key bindings C-h/j/k/l
set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W
.) I'd like to use the same keystrokes for switching tmux panes.
An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\
.
Here's how it should work:
Problem: When linking to the raw version of a gist, the link changes with each revision.
Solution:
To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/
To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]
#!/usr/bin/env bash | |
# fresh-chrome | |
# | |
# Use this script on OS X to launch a new instance of Google Chrome | |
# with its own empty cache, cookies, and user configuration. | |
# | |
# The first time you run this script, it will launch a new Google | |
# Chrome instance with a permanent user-data directory, which you can | |
# customize below. Perform any initial setup you want to keep on every |
#!/usr/bin/env bash | |
# script: watch | |
# author: Mike Smullin <[email protected]> | |
# license: GPLv3 | |
# description: | |
# watches the given path for changes | |
# and executes a given command when changes occur | |
# usage: | |
# watch <path> <cmd...> | |
# |
// See http://stackoverflow.com/questions/21934831/nodejs-express-stream-stdout-instantly-to-the-client | |
var cp = require("child_process"), | |
express = require("express"), | |
app = express(); | |
app.get('/', function(req, res){ | |
res.writeHead(200, { "Content-Type": "text/event-stream" }); | |