start new:
tmux
start new with session name:
tmux new -s myname
#!/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 |
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
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 |
// 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 |
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});
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script src="https://rawgit.com/lhorie/mithril.js/next/mithril.js"></script> | |
<script id="jsbin-javascript"> | |
// noprotect |
#!/bin/bash | |
# Sample App Init script for running sample app daemon | |
# | |
# chkconfig: - 98 02 | |
# | |
# description: Sample Application Upstart, using Forever | |
APPHOME=/opt/sample-app | |
APPSCRIPT=app.js |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Mithril experiment</title> | |
<meta name="description" content="mithriljs: Mithril template"> | |
<meta charset="utf-8"> | |
<script> | |
window.log = function(){ | |
log.history = log.history || []; // store logs to an array for reference |