Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

denisinla

:octocat:
View GitHub Profile
@denisinla
denisinla / web.js
Created Aug 20, 2014
Express server config for backbone SPAs with pushState set to true. (http://stackoverflow.com/a/18553854/1172652)
View web.js
var http = require('http');
var fs = require('fs');
var express = require('express');
var app = express();
// Read all static files from directory
app.use(express.static(__dirname + '/../app/'));
// Default HTML file for any requests
app.use(function(req,res){
View backbone_pushstate_router.js
// Use absolute URLs to navigate to anything not in your Router.
var openLinkInTab = false;
// Only need this for pushState enabled browsers
if (Backbone.history && Backbone.history._hasPushState) {
$(document).keydown(function(event) {
if (event.ctrlKey || event.keyCode === 91) {
openLinkInTab = true;
View app.coffee
# if the resource is not found then forward to backbone's router
app.use (req, res) ->
newUrl = req.protocol + '://' + req.get('Host') + '/#' + req.url
res.redirect newUrl
@denisinla
denisinla / web.js
Created Aug 26, 2014
Express mod for pushstate.
View web.js
var express = require('express');
var app = express();
app.set('port', (process.env.PORT || 80));
app.use(express.static(__dirname + '/../app'));
app.use(function(req, res) {
var newUrl = req.protocol + '://' + req.get('Host') + '/#' + req.url;
return res.redirect(newUrl);
});
View trajan.zsh-theme
PROMPT='%{$fg_bold[yellow]%} λ %c: %{$reset_color%}'
RPROMPT='$(git_prompt_info) $(git_prompt_short_sha) %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}Branch%{$reset_color%}%{$fg[grey]%} / %{$reset_color%}%{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[green]%}"
#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[grey]%} %{$fg[yellow]%}| SHA:%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[grey]%} / %{$reset_color%}%{$fg[red]%}SHA:%{$reset_color%}%{$fg[green]%}"
View rvm-dotfile-fix.sh
$ rvm get stable --auto-dotfiles
View .gitignore
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20140606
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@denisinla
denisinla / simulator.sh
Created Jan 21, 2015
simulator command + simulator device selection
View simulator.sh
xcrun simctl
xcrun instruments -w "iPhone 5 (8.0 Simulator)"
@denisinla
denisinla / docker.sh
Created Jan 29, 2015
Docker commands
View docker.sh
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)