Skip to content

Instantly share code, notes, and snippets.

View denisinla's full-sized avatar
👋

denisinla

👋
View GitHub Profile
@denisinla
denisinla / web.js
Created August 20, 2014 03:41
Express server config for backbone SPAs with pushState set to true. (http://stackoverflow.com/a/18553854/1172652)
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){
// 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;
# 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 August 26, 2014 01:55
Express mod for pushstate.
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);
});
@denisinla
denisinla / trajan.zsh-theme
Created August 29, 2014 06:07
theme for ohmyzsh
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]%}"
@denisinla
denisinla / rvm-dotfile-fix.sh
Created October 8, 2014 02:52
RVM is not a function
$ rvm get stable --auto-dotfiles
@denisinla
denisinla / .gitignore
Last active August 29, 2015 14:09 — forked from salcode/.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

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

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