Skip to content

Instantly share code, notes, and snippets.

@mamarjan
mamarjan / gist:3426533
Created August 22, 2012 15:05
Various settings
From .bashrc:
alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit '
alias gd='git diff '
alias go='git checkout '
alias gk='gitk --all&'
@mamarjan
mamarjan / seg_fault.d
Created June 11, 2012 18:38
Minimal example for GC seg fault in D
// Run this file with one large text file and a segmentation fault should occur
import std.stdio, std.file, std.conv, std.string;
File input_file;
void main(string[] args) {
input_file = File(args[1], "r");
while(true) {
next_item();
try_and_catch();
@mamarjan
mamarjan / gist:2905145
Created June 10, 2012 11:55
Methods chaining pattern
mixin template Identity()
{
uint id = ID_UNKNOWN;
string name = NAME_UNKNOWN;
this() { }
auto set_id(uint new_id) { this.id = new_id; return this; }
auto set_name(string new_name) { this.name = new_name; return this; }
}