Skip to content

Instantly share code, notes, and snippets.

@mattwiebe
mattwiebe / unCamelCase.js
Created June 3, 2011 05:27
unCamelCase.js
/**
* Turns someCrazyName into Some Crazy Name
* Decent job of acroynyms:
* ABCAcryonym => ABC Acryoynm
* xmlHTTPRequest => Xml HTTP Request
*/
String.prototype.unCamelCase = function(){
return this
// insert a space between lower & upper
.replace(/([a-z])([A-Z])/g, '$1 $2')
@einblicker
einblicker / gist:1338773
Created November 4, 2011 06:14
scalaz and reify/reflect
import util.continuations._
import scalaz._
import Scalaz._
def reify[M[_] : Monad, A](body: => A @cps[M[A]]): M[A] =
reset{val result: A = body; implicitly[Monad[M]].pure[A](result)}
implicit def monad2reflect[M[_] : Monad, A](action: M[A]) = new {
def reflect[B]: A @cps[M[B]] =
shift{(k: A => M[B]) => implicitly[Monad[M]].bind(action, k)}
@davidnunez
davidnunez / gist:1741710
Created February 5, 2012 01:10
SSH trick: pipe microphone input of one machine to the speakers of another machine
dd if=/dev/dsp | ssh -C user@host dd of=/dev/dsp

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 21, 2024 01:45
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ryin
ryin / tmux_local_install.sh
Last active April 23, 2024 01:06
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@mraleph
mraleph / gist:3397008
Created August 19, 2012 18:48
simple and incomplete explanation of V8 strings

There are two types (actually more, but for the problem at hand only these two are important):

  • flat strings are immutable arrays of characters

  • cons strings are pairs of strings, result of concatenation.

If you concat a and b you get a cons-string (a, b) that represents result of concatenation. If you later concat d to that you get another cons-string ((a, b), d).

Indexing into such a "tree-like" string is not O(1) so to make it faster V8 flattens the string when you index: copies all characters into a flat string.

@datagrok
datagrok / git-branch-simplify.md
Last active April 16, 2024 17:26
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version 1.7.10.4.

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

@walkie
walkie / mips.sty
Last active March 16, 2024 09:43
MIPS Assembly language definition for the LaTeX listings package.
% MIPS Assembly language definition for the LaTeX `listings' package
%
% The list of instructions and directives are those understood by the
% MARS MIPS Simulator [http://courses.missouristate.edu/KenVollmar/MARS/]
%
% Author: Eric Walkingshaw <eric@walkingshaw.net>
%
% This code is in the public domain.
%
% Here is an example style. I like it for slides, but you might want