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
On Safari Online there is book available from Erlang O'Reilly Media, which will be released just tomorrow - June 26, 2009 | |
Content of the book has a little bit of everything. Starting from the language basics and the introduction to its different applications, e.g. GUI programming, integration with Java, OTP and Mnesia. | |
I have read the whole book with a real pleasure. | |
So now we have two books, the first one was, published in 2007, Pragmatic Programming Erlang. |
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(strre). | |
-author("Daniel Kwiecinski: lambder.com"). | |
-purpose("string replace functionality"). | |
-export([sub/3,gsub/3,test/0]). | |
sub(Str,Old,New) -> | |
RegExp = "\\Q"++Old++"\\E", | |
re:replace(Str,RegExp,New,[multiline, {return, list}]). | |
gsub(Str,Old,New) -> |
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
%% @author Daniel Kwiecinski <daniel@lambder.com> | |
%% @copyright Daniel Kwiecinski author. | |
%% @doc Example of redirect webmachine_resource. | |
-module(redirect_resource). | |
-export([init/1, resource_exists/2, moved_temporarily/2, previously_existed/2]). | |
-include_lib("webmachine/include/webmachine.hrl"). | |
init([]) -> {ok, undefined}. |
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(scroogle_scrapper). | |
-compile(export_all). | |
-define(SCROOGLE_URL, "https://ssl.scroogle.org/cgi-bin/nbbw.cgi"). | |
-define(SCROOGLE_PEM, "[PATH_TO_SSL_SCROOGLE_ORG_PEM_CERTIFICATE]"). | |
start() -> | |
inets:start(), | |
ssl:start(). |
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
% copied from Mochiweb's mochiweb_uitl.erl | |
-module(url_encoder). | |
-export([encode/1]). | |
-define(PERCENT, 37). % $\% | |
-define(FULLSTOP, 46). % $\. | |
-define(IS_HEX(C), ((C >= $0 andalso C =< $9) orelse | |
(C >= $a andalso C =< $f) orelse | |
(C >= $A andalso C =< $F))). | |
-define(QS_SAFE(C), ((C >= $a andalso C =< $z) orelse |
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(google_scrapper). | |
-compile(export_all). | |
-define(GOOGLE_URL, "http://www.google.co.uk/search?hl=en&btnG=Search&meta=&q="). | |
start() -> inets:start(). | |
fetch_google_results(Q) -> | |
% In case of redirect lets erlang take care of this for us |
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
# that's SpiderMonkey | |
sudo apt-get install libmozjs-dev | |
sudo apt-get install libcurl4-openssl-dev | |
wget ftp://mirror.public-internet.co.uk/pub/apache/couchdb/0.9.0/apache-couchdb-0.9.0.tar.gz | |
tar -xzvf apache-couchdb-0.9.0.tar.gz | |
cd apache-couchdb-0.9.0/ | |
./configure | |
make |
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 Java::ClojureLang::IPersistentMap | |
def keys | |
keySet() | |
end | |
def has_key?(key) | |
containsKey(key) | |
end | |
def include?(key) | |
containsKey(key) | |
end |
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
class BasicGraph | |
include_package 'clojure.lang' | |
attr_reader :nodes, :edges | |
def self.empty | |
BasicGraph.new(PersistentHashMap::EMPTY, PersistentHashMap::EMPTY) | |
end |
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
%% @author author <daniel.kwiecinski@lambder.com> | |
%% @copyright Daniel Kwiecinski. | |
%% @doc Static webmachine resource. | |
-module(static_resource). | |
-export([init/1, allowed_methods/2, | |
content_types_provided/2, resource_exists/2, last_modified/2, provide_content/2]). | |
-include_lib("webmachine/include/webmachine.hrl"). | |
-include_lib("kernel/include/file.hrl"). |
NewerOlder