Skip to content

Instantly share code, notes, and snippets.

var tcp = require("tcp");
var server = tcp.createServer(function (socket) {
var client;
socket.addListener("connect", function () {
client = tcp.createConnection(22);
client.addListener("receive", function (data) {
socket.send(data);
});
client.addListener("eof", function () {
:model
form(user)
p
field(name)
p
field(email)
p
field(summary, as: 'textarea')
buttons
@indexzero
indexzero / round-robin-proxy.js
Created March 14, 2011 20:15
A simple example of how to do round-robin proxying for a single domain
var httpProxy = require('http-proxy');
//
// Addresses to use in the round robin proxy
//
var addresses = [
{
host: 'ws1.0.0.0',
port: 80
},
@tj
tj / ps1.sh
Created June 11, 2011 03:34
ps1
function git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \(\1\)/'
}
PS1=" λ \W\$(git_branch): "
PS2=" | "
(ns apples.core
(:require [play-clj.core :refer :all]
[play-clj.g2d :refer :all]
[play-clj.math :refer :all]))
(declare apples main-screen)
(def speed 14)
(defn- get-direction []
(cond
@yang-wei
yang-wei / destructuring.md
Last active July 4, 2024 16:56
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))