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
/* | |
The MIT License (MIT) | |
Copyright (c) 2014 Ismael Celis | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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 '(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))))) |
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
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 -> |
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
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'; |
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
/* | |
* ATTENTION: | |
* | |
* This layout is now maintained in the `iosched' code.google.com project: | |
* | |
* http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java | |
* | |
*/ | |
/* |
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
(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)) |
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
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 |
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
!------------------------------------------------------------------------------- | |
! Xft settings | |
!------------------------------------------------------------------------------- | |
Xft.dpi: 96 | |
Xft.antialias: false | |
Xft.rgba: rgb | |
Xft.hinting: true | |
Xft.hintstyle: hintslight |
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
# The latest version of this script is now available at | |
# https://github.com/jasoncodes/dotfiles/blob/master/aliases/rbenv.sh | |
VERSION=1.9.3-p286 | |
brew update | |
brew install rbenv ruby-build rbenv-vars readline ctags | |
if [ -n "${ZSH_VERSION:-}" ]; then | |
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc | |
else | |
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile |
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 Main where | |
import Test.QuickCheck (quickCheck) | |
import Your.Module (encrypt, decrypt) | |
prop_reverseReverse :: [Char] -> Bool | |
prop_reverseReverse s = (reverse . reverse) s == s | |
prop_encryptDecrypt :: [Char] -> Bool | |
prop_encryptDecrypt s = (encrypt . decrypt) s == s |
OlderNewer