This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
var express = require('express'); | |
var redis = require('redis'); | |
var db = redis.createClient(); | |
var app = express(); | |
// track users online (replace UA string with user id) | |
app.use(function(req, res, next){ | |
var ua = req.headers['user-agent']; |
// assets | |
// first installed modules | |
var util = require('util') | |
var assert = require('assert') | |
var whatever = require('whatever') | |
// then local | |
var foo = require('./foo') | |
var bar = require('./bar') |
#!/bin/bash | |
HOSTSFILE="/etc/hosts" | |
BAKFILE="$HOSTSFILE.bak" | |
DOMAINREGEX="^[a-zA-Z0-9]{1}[a-zA-Z0-9\.\-]+$" | |
IPREGEX="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" | |
URLREGEX="^https?:\/\/[a-zA-Z0-9]{1}[a-zA-Z0-9\/\.\-]+$" | |
backup() | |
{ |
var svg = document.getElementById('graph'), | |
xml = new XMLSerializer().serializeToString(svg), | |
data = "data:image/svg+xml;base64," + btoa(xml), | |
img = new Image() | |
img.setAttribute('src', data) | |
document.body.appendChild(img) |
the goal: to do fast virtual host routing, e.g. to have a single process on a machine listening on port 80 and proxying data based on HTTP Host to other non-port-80 web processes on the same machine
many people use nginx for this because nginx is faster than node is currently for data-heavy applications (see below)
they use the JS proxies from https://github.com/substack/bouncy/tree/master/bench
(defn debounce [in ms] | |
(let [out (chan)] | |
(go-loop [last-val nil] | |
(let [val (if (nil? last-val) (<! in) last-val) | |
timer (timeout ms) | |
[new-val ch] (alts! [in timer])] | |
(condp = ch | |
timer (do (>! out val) (recur nil)) | |
in (recur new-val)))) | |
out)) |
(empty? (d/datoms db :aevt :user/id)) | |
;;=> false | |
(not-empty (d/datoms db :aevt :user/id)) | |
;;=> #<db$datoms$reify__3265 datomic.db$datoms$reify__3265@7939b07> | |
(seq (d/datoms db :aevt :user/id)) | |
;;=> (#Datum{:e 17592186046081 :a 70 :v "abc" :tx 13194139534976 :added true} ...) | |
(first (d/datoms db :aevt :user/id)) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/bin/bash | |
dscacheutil -flushcache && sudo killall -HUP mDNSResponder |