- Only first pass complete: raw translation from Java example to Scala.
- Second pass [incomplete]: abstracting to make server and client specific code composable.
- Create declarative and composable Pipeline definition
(use '(incanter core charts excel)) | |
;; read .xls file of Australian airline passenger data from the 1950s. | |
(with-data (read-xls "http://incanter.org/data/aus-airline-passengers.xls") | |
(view $data) | |
;; time-series-plot needs time in millisecs | |
;; create a function, to-millis, to convert a sequence of Date objects | |
;; to a sequence of milliseconds | |
(let [to-millis (fn [dates] (map #(.getTime %) dates))] | |
(view (time-series-plot (to-millis ($ :date)) ($ :passengers))))) |
X = fun() -> | |
lists:foldl(fun(Pid, Acc) -> | |
case erlang:process_info(Pid,message_queue_len) of | |
undefined -> | |
Acc; | |
{_, Len} -> | |
if | |
Len > 3 -> | |
[{Len, process_info(Pid)} | Acc]; | |
true -> |
local chat_demo = Handler { | |
send_spec = 'tcp://127.0.0.1:9999'; | |
send_ident = '8b7c7833-0932-4d9a-92c3-3b8c06d9b855'; | |
recv_spec = 'tcp://127.0.0.1:9998'; | |
recv_ident = ''; | |
} | |
local chat_demo_dir = Dir { | |
base = 'static/chatdemo/'; | |
index_file = 'index.html'; |
(defn watch | |
"Returns (running) thread which observes the value of f every delay | |
milliseconds, and calls the callback fn if the value changes. callback | |
will be called with the old and new values from f" | |
([f callback delay] | |
(let [proc (fn [] | |
(loop [x1 ::watch-init] | |
(let [x2 (f)] | |
(when (not= x1 x2) | |
(callback x1 x2)) |
require 'active_support/time' | |
bucket = Fog::Storage.new(:provider => 'AWS').directories.select {|d| d.key == 'my_bucket'} | |
files = bucket.files.select {|f| f.content_length > 0 && | |
f.key =~ %r{client-name.*\.zip}} | |
expiration = Time.now.next_month.end_of_month | |
signed_urls = files.map {|f| f.url(expiration)} | |
fixed_signed_url = signed_urls.map do |su| | |
su.sub(%r{s3\.(.*)/my_bucket}, "my_bucket.s3.#{$1}") | |
end |
require 'riak/cluster' | |
cluster = Riak::Cluster.new(:count => 4, :source => "/usr/local/Cellar/riak/1.0.3/libexec/bin", :root => "~/mycluster") | |
cluster.create | |
cluster.start | |
cluster.join |
%% @doc Uses SAX to convert an XML document into a simple nested-tuple | |
%% structure. Ignores namespaces. | |
-module(xmlsimple). | |
-export([file/1, | |
string/1, | |
emit/1, | |
emit_file/2]). | |
-include_lib("xmerl/include/xmerl.hrl"). |
(defun web-reload-iphonesimulator () | |
"Reload a page on iPhone Simulator. Run process associated to the *Messages* buffer" | |
(interactive) | |
(start-process-shell-command | |
"iphonesimulator-process" | |
"*Messages*" | |
"osascript -e 'tell application \"System Events\"' -e 'tell process \"iPhone Simulator\"' -e 'click button \"Reload\" of window 1' -e 'end tell' -e 'end tell'")) |
var get = Ember.get; | |
/** | |
* @extends Ember.Mixin | |
* | |
* Implements common filter / sort / pagination behavior for array controllers | |
* */ | |
Ember.FilterSortSliceMixin = Ember.Mixin.create({ | |
filterBy: '', |