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
> viviendas <- read.table("Viviendas.dat", header=T, sep="\t") | |
> head(viviendas) | |
DPTO LOC SECC SEGM VIVID VIVVO01 VIVVO03 VIVVO04 VIVDV01 VIVDV02 VIVDV03 VIVDV05 VIVDV06 VIVDV07 VIVHV01 VIVHV01_1 CATEVIV | |
1 1 20 1 1 1 9 3 2 0 0 0 0 0 0 0 0 0 | |
2 1 20 1 1 2 1 4 0 0 0 0 0 0 0 0 0 0 | |
3 1 20 1 1 3 3 1 0 1 1 1 1 1 1 1 1 1 | |
4 1 20 1 1 4 3 1 0 1 1 1 1 1 1 1 1 1 | |
5 1 20 1 1 5 3 1 0 1 1 1 1 1 1 1 1 1 | |
6 1 20 1 1 6 1 6 0 0 0 0 0 0 0 0 0 0 |
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
(ns dispatchers.call | |
(:require [clj-asterisk.manager :as manager] | |
[clj-asterisk.events :as events] | |
[dispatchers.model :as model]) | |
(:import java.util.UUID)) | |
;; Signal the end of the call to the waiting promise in order to | |
;; release the channel | |
(defmethod events/handle-event "Hangup" | |
[event context] |
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
(ns notify-blaster.models.validation.user) | |
(def rules | |
{ :username {:validations | |
{:required true | |
:unique true | |
:max-length 50} | |
:messages | |
{:required "User name is required" | |
:unique "User name %s is already in use, please choose another one" |
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
(ns notify-blaster.models.validation.core) | |
(def ^{:dynamic true} *is-unique?* (fn [value] false)) | |
(def ^{:dynamic true} *default-messages* {:unique "Value %s is aready taken, please choose another one" | |
:required "Field is required" | |
:min-length "Field is shorter than required" | |
:max-length "Field is longer than required" | |
:range "Field value %s is not in range" | |
:email "Field must be a valid email address" | |
:matches "Fields do not match"}) |
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
select TagName, | |
avg(cast(ResponseTime as bigint)) as Average, | |
stdev(cast(ResponseTime as bigint)) as StandardDev | |
from | |
(SELECT | |
Questions.CreationDate, | |
Questions.Title, | |
Tags.TagName, | |
Answers.CreationDate as ResponseDate, | |
datediff(minute, Questions.CreationDate, |
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
DECLARE @tagname varchar(20) = ##language:string## | |
select ResponseHour, | |
avg(cast(ResponseTime as bigint)) as Average, | |
stdev(cast(ResponseTime as bigint)) as StandardDev | |
from | |
(SELECT | |
Questions.CreationDate, | |
Questions.Title, |
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
DECLARE @tagname varchar(20) = ##language:string## | |
select DifficultyGroup, Count(1) Total, | |
avg(cast(ResponseTime as bigint)) as Average, | |
stdev(cast(ResponseTime as bigint)) as StandardDev | |
from | |
(SELECT | |
Questions.CreationDate, | |
Questions.Title, | |
Tags.TagName, |
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
(ns qstk.tutorial1 | |
(:use [clj-time.core :exclude 'extend]) | |
(:use clj-time.format) | |
(:use clj-time.coerce) | |
(:require incanter.io) | |
(:require incanter.core)) | |
(def ^{:dynamic true} *QS* (get (System/getenv) "QS")) | |
(defn get-NYSE-days |
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 run | |
[] | |
(let [symbols ["AAPL","GLD","GOOG","$SPX","XOM"] | |
start-day (date-time 2012 1 1) | |
end-day (date-time 2012 12 31) | |
time-of-day (hours 16) | |
timestamps (get-NYSE-days start-day end-day time-of-day) | |
symbols-data (read-symbols-data "Yahoo" symbols) | |
adj-close-data (incanter.core/to-dataset | |
(get-data timestamps symbols (keyword "Adj Close") symbols-data time-of-day))] |
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
(defmacro apply-filtered | |
"Given two sequences, apply a function to each pair of elements when condition is met | |
anaphoras n and m exists for each indexed element | |
e.g. (apply-filtered / [1 2 3] [1 0 3] when (> m 0)) => (1 nil 1) | |
" | |
[op a b & condition] | |
`(for [x# (range (count ~a))] | |
(let [n# (nth ~a x#) |