This file contains hidden or 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
# for osx users | |
find . -type f \( -name "*.erl" -or -name "*.hrl" -or -name "*.app.src" \) -exec cat {} \; | sed '/^\s*$/d;/^\s*\%\%/d;/^\-spec*/d' | wc -l |
This file contains hidden or 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(exp_parser). | |
-export([parse/1]). | |
% Parse simple math expressions. | |
% Currently works (for certain definitions of "works") | |
% for addition, subtraction and multiplication. | |
% Eventually it should handle a unary negation operator (~) | |
% The goal is to do the following: | |
% parse("(2 + 3)") => {plus, {num, 2}, {num, 3}} |
This file contains hidden or 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
$text = $tweet->title; | |
$text = preg_replace("#(^|[\n ])@([^ \"\t\n\r<]*)#ise", "'\\1<a href=\"http://www.twitter.com/\\2\" >@\\2</a>'", $text); | |
$text = preg_replace("#(^|[\n ])([a-z]+:\/\/\S+[^ \.{1,3}$])#ise", "'\\1<a href=\"\\2\" >\\2</a>'", $text); | |
$text = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#ise", "'\\1<a href=\"http://\\2\" >\\2</a>'", $text); |
This file contains hidden or 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
# mongo_template.rb | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# | |
# To use: | |
# rails project_name -m http://gist.github.com/gists/219223.txt | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" |
This file contains hidden or 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(histo). | |
-compile(export_all). | |
-define(WORDS,[ "a", "at", "red", "green", "dog"]). | |
parse_input(Input) -> | |
lists:foldl(fun(Letter, D) -> dict:update(Letter, fun(N) -> N + 1 end, 1, D) | |
end, dict:new(), | |
[L || L <- Input]). | |
start_find(InputHisto) -> |
This file contains hidden or 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
#!/usr/bin/ruby | |
RLSP_VERSION = "1.4.1" | |
class Lambda | |
attr_accessor :args, :body | |
def initialize(args=[],body="") | |
@args = (args.class == Array) ? args : [args] | |
@body = body | |
end |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
int | |
main(int argc, char** argv) { | |
char protein[4] = "ACGT"; | |
int size = atoi(argv[1]); | |
int i = 0; | |
int pos = 0; | |
for(i; i < size; ++i) { |