This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Topological sorting of a list of dependencies as pairs of | |
%% {label, [label]} where the list contains dependees. | |
%% | |
%% > tsort:tsort([{a,["b",c]}, {c, [1]}]). | |
%% ["b",1,c,a] | |
-module(tsort). | |
-export([tsort/1]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; File: emacs-indent-erlang | |
;;; adapted from http://www.cslab.pepperdine.edu/warford/BatchIndentationEmacs.html | |
;; this has to be set to the real path on your system | |
(add-to-list 'load-path "~/.emacs.d/elpa/erlang-20131025.6") | |
(load-library "erlang") | |
;; comment out the call to untabify if you want the mixed tabs and spaces | |
(defun emacs-indent-function () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
git stash -u --keep-index | |
# .... work .... | |
# get only affected files with | |
git status --porcelain | |
# | |
git reset --hard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# A (client-side) git hook script which warns if there are too long lines in | |
# the commit message, not fitting with 50/72 formatting. | |
# | |
# To use this script, copy it as .git/hooks/commit-msg and give it an executable | |
# file permission. | |
# | |
FILE=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dump_hex(Binary) -> | |
dump_hex(Binary, 32). | |
dump_hex(Binary, Size) -> | |
dump_hex(Binary, Size, []). | |
dump_hex(Bin, Size, R) -> | |
case Bin of | |
<<H:Size/binary, T/binary>> -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CooldownRestartPolicy extends ServiceRestartPolicy { | |
/** | |
* If restarting sooner than this, it's probably an unrecoverable error. | |
*/ | |
public static final int RESTART_INTERVAL = 5000; | |
private long last; | |
private long interval = RESTART_INTERVAL; | |
public CooldownRestartPolicy() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.eclipse.core.runtime.Path; | |
public interface IPreferenceNotifier { | |
void changed(Path path, String key, String newValue); | |
void added(Path path, String key); | |
void removed(Path path, String key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_application_doc(A) ->... | |
% from edoc in the sources | |
get_module_source_doc(M) ->... | |
% from external files | |
get_module_external_doc(M) ->... | |
get_function_spec(M, F, A) ->... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(cancellable_worker). | |
-behaviour(gen_server). | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). | |
%% ==================================================================== | |
%% API functions | |
%% ==================================================================== |
OlderNewer