Skip to content

Instantly share code, notes, and snippets.

@aphyr
aphyr / gist:3200829
Created July 29, 2012 18:29
Node.js message passing test
var cluster = require('cluster');
var m = 10000000;
function bounce(msg, out) {
if (msg < m) {
out.send(msg + 1);
return null;
} else {
console.log("Finished with", msg);
@mitsuoka
mitsuoka / MIME.dart
Last active November 11, 2022 12:43
Dart WebSocket chat server and client samples
library MIME;
// get MIME type (returns null if there is no such extension)
String mimeType(String extension) => _mimeMaps[extension];
// default MIME type mappings
Map _mimeMaps = const {
'abs': 'audio/x-mpeg',
'ai': 'application/postscript',
'aif': 'audio/x-aiff',
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active December 8, 2025 03:35
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mitsuoka
mitsuoka / DumpHttpRequest.dart
Last active October 4, 2015 14:28
Dart HTTP server code sample : Returns available information from the request.
/*
Dart code sample : Simple tool for HTTP server development
Returns contents of the HTTP request to the client
1. Save these files into a folder named DumpHttpRequest.
2. From Dart editor, File > Open Folder and select this DumpHttpRequest folder.
3. Run DumpHttpRequest.dart as server.
4. Access the DumpHttpRequest.html file from your browser such as : file:///C:/ … /DumpHttpRequest/DumpHttpRequest.html
5. Enter some text to the text areas and click “Submit using POST” or “Submit using GET” button.
6. This server will return available data from the request. This data is also available on the Dart editor’s console.
Ref: www.cresc.co.jp/tech/java/Google_Dart/DartLanguageGuide.pdf (in Japanese)
@spikebike
spikebike / client.go
Created March 29, 2012 01:13
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@addyosmani
addyosmani / gitback.rb
Created March 22, 2012 16:15
A little Ruby script for backing up *all* of the repos on your GitHub account with a single command
#gitback 0.1
#usage: sudo ruby gitback.rb
#credits: walter white, minor changes: addy osmani
#!/usr/bin/env ruby
# dependencies
require "yaml"
require "open-uri"
time = Time.new

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@rstacruz
rstacruz / index.md
Last active August 2, 2025 18:42
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/