Skip to content

Instantly share code, notes, and snippets.

// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that ajax call
is complete, we want to call two. Once two's ajax call is complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick
demo will show. Look at this sample function and think about what order
<%@include file="../common.jsp"%>
new Locale("TH","TH")
java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
To fix, you need to do something like this:
a.divide(b, 2, RoundingMode.HALF_UP)
where 2 is precision and RoundingMode.HALF_UP is rounding mode
http://stackoverflow.com/questions/4591206/arithmeticexception-non-terminating-decimal-expansion-no-exact-representable
http://osxdaily.com/2009/02/25/show-hidden-files-in-os-x/
@sysnajar
sysnajar / gist:9997431
Created April 5, 2014 20:05
Generate "Loading" gif animation from here
http://preloaders.net/en/search/windows%208

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Android
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">-->
<!-- iPad/iPhone specific css below, add after your main css >
@sysnajar
sysnajar / nodejs-tcp-example.js
Last active September 4, 2015 07:24 — forked from tedmiston/nodejs-tcp-example.js
Node.js tcp client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@sysnajar
sysnajar / gist:4878d2bbc494bf08227b
Last active September 13, 2015 15:31 — forked from zacharyvoase/gist:1770447
zmqc: A small but powerful command-line interface to ZMQ.
#!/usr/bin/env python
# zmqc: a small but powerful command-line interface to ZMQ.
## Usage:
# zmqc [-0] (-r | -w) (-b | -c) SOCK_TYPE [-o SOCK_OPT=VALUE...] address [address ...]
## Examples:
# zmqc -rc SUB 'tcp://127.0.0.1:5000'
#
# Subscribe to 'tcp://127.0.0.1:5000', reading messages from it and printing