Skip to content

Instantly share code, notes, and snippets.

# Comment in the above and uncomment this below for a color prompt
PS1='\[\033[01;32m\]\u@\h\[\033[00m\] ~~ \[\033[01;32m\]\w\[\033[00m\]\n\$> '
if [ -f ~/.bash_completion ]; then
. ~/.bash_completion
fi
if [ -f ~/.bash_alias ]; then
. ~/.bash_alias
fi
sync_git_branches () {
for BRANCH in $(git remote); do
git pull $BRANCH master;
done
}
sync_git_repos () {
CURR=$(pwd);
for DIR in $(ls); do
cd $DIR; sync_git_branches;
use DB::CouchDB::Schema;
use DBI;
my $mysql = DBI->connect("DBI:mysql:database=<databaseName>;host=localhost", '<username>', '<password>');
my $schema = DB::CouchDB::Schema->new(host => 'localhost', db => 'metabase');
my $sth = $mysql->prepare("select post_name,
post_title,
post_date,
post_category,
sub return_errors() {
my $do_error = shift;
if ($do_error) {
return {error => 1};
}
return {error => 0};
}
my $is_error = return_errors(1);
-module(db_migrate_tools).
-compile(export_all).
-include("iterate_records.hrl").
-include_lib("stdlib/include/qlc.hrl").
get_transformed(T, F) ->
Trans = fun() ->
QH = qlc:q([F(R) || R <- mnesia:table(T)])
, qlc:eval(QH)
@zaphar
zaphar / date_util.erl
Created May 1, 2009 06:07
set of utility functions that wrap the calendar module and erlangs now() date() and time() functions
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
-module(element_flot_chart).
-compile(export_all).
-include_lib("nitrogen/include/wf.inc").
-include("elements.hrl").
reflect() -> record_info(fields, flot_chart).
rec() -> #flot_chart{}.
-module(string_utils).
-compile(export_all).
flatten_string_list(List) when is_list(List) ->
flatten_string_list(List, []).
flatten_string_list([H|T], Tail) when is_list(H) ->
case io_lib:char_list(H) of
false ->
flatten_string_list(H, flatten_string_list(T, Tail));
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/
*
* Custom erlang SyntaxHighlighterBrush
*/
SyntaxHighlighter.brushes.Erlang = function()
{
// Contributed by David Simmons-Duffin and Marty Kube
-module (web_postback_test).
-include_lib ("nitrogen/include/wf.inc").
-compile(export_all).
main() ->
%TODO(jwall): force identity
#template { file="./wwwroot/api_test.html"}
.
test() ->