Skip to content

Instantly share code, notes, and snippets.

@veggiemonk
veggiemonk / install_font_scp.sh
Created July 2, 2015 13:07
install source code pro font in Ubuntu 14.04.2
#!/bin/sh
echo "installing fonts at $PWD to ~/.fonts/"
mkdir -p ~/.fonts/adobe-fonts/source-code-pro
git clone https://github.com/adobe-fonts/source-code-pro.git ~/.fonts/adobe-fonts/source-code-pro
# find ~/.fonts/ -iname '*.ttf' -exec echo \{\} \;
fc-cache -f -v ~/.fonts/adobe-fonts/source-code-pro
echo "finished installing"

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# from hyphen/dash to camelCase
rename 's/-(\w)/\U$1/g' list-of-files
# from camelCase to hyphen/dash
sed -e 's/\([A-Z]\)/-\L\1/g' -e 's/^-//' <<< "MyDirectoryFileLine"
@veggiemonk
veggiemonk / cb-out
Last active August 29, 2015 14:25 — forked from Gen2ly/cb-out
Paste contents of Xorg clipboard to a file from the command line
#!/bin/bash
# Paste contents of Xorg clipboard to a file from the command line
filename=$@
pasteinfo="clipboard contents"
# Display usage if no parameters given
if [[ -z "$@" ]]; then
echo " ${0##*/} <filename> - paste contents of context-menu clipboard to file"
exit
@veggiemonk
veggiemonk / nginxproxy.md
Last active August 29, 2015 14:26 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@veggiemonk
veggiemonk / Makefile
Created October 5, 2015 07:42 — forked from lox/Makefile
Replaced Grunt/Gulp with a Makefile
SASSC = sass --style compact
COMPSDIR = resources/assets/components
SASSDIR = resources/assets/css
JSDIR = resources/assets/js
DISTDIR = web/dist
CSSDIR = $(DISTDIR)/css
SASSINC = $(SASSDIR) \
$(COMPSDIR)/asimov/src/scss \
$(COMPSDIR)/asimov-contests/src/scss \
$(COMPSDIR)/asimovicons/src/scss
@veggiemonk
veggiemonk / functions.js
Created November 11, 2015 10:36 — forked from gilbert/functions.js
JavaScript Function Extensions
// Partially apply arguments to a function. Useful for binding
// specific data to an event handler.
// Example:
//
// var add = function (x,y) { return x + y }
// var add5 = add.papp(5)
// add5(7) //=> 11
//
Function.prototype.papp = function () {
var slice = Array.prototype.slice
@veggiemonk
veggiemonk / README.md
Created November 13, 2015 11:19 — forked from pr1001/README.md
Immutable Javascript object properties

Wish you had some immutability in Javascript? Now you can!

var t = {a: 1, b: 2}.immutable();
console.log(t.a, t.b);
try {
  t.a = 3; // ->  Uncaught Error: a is immutable and cannot be modified.
} catch (e) {
  console.log(e);
}

var t2 = t.copy({a: 3});