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
(defproject com.evocomputing/rincanter | |
"1.0.0-SNAPSHOT" | |
:description "Clojure/R integration using rosuda JRIEngine" | |
:dependencies [[org.clojure/clojure "1.2.0"] | |
[org.clojure/clojure-contrib "1.2.0"] | |
[incanter "1.2.3"]] | |
:native-dependencies [[jriengine "0.8.4"]] |
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 'package) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/")) | |
(package-initialize) |
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
(eval-after-load 'clojure-mode | |
'(progn | |
(require 'paredit) | |
(defun clojure-paredit-hook () (paredit-mode +1)) | |
(add-hook 'clojure-mode-hook 'clojure-paredit-hook) | |
(define-key clojure-mode-map "{" 'paredit-open-brace) | |
(define-key clojure-mode-map "}" 'paredit-close-brace))) |
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 bookkeeper.database | |
(:require [clojure.java.jdbc :as sql] | |
[clj-time.format :as f])) | |
(def db {:classname "com.mysql.jdbc.Driver" | |
:subprotocol "mysql" | |
:subname "//database-server:3306/database" | |
:user "user" | |
:password "password"}) |
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
<build> | |
<plugins> | |
<plugin> | |
<groupId>com.theoryinpractise</groupId> | |
<artifactId>clojure-maven-plugin</artifactId> | |
<version>1.3.2</version> | |
<executions> | |
<execution> | |
<id>test-clojure</id> |
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 relation.test.relation | |
(:require [relation.relation :as rel] | |
[relation.database :as db] | |
[clojureql.core :as cql]) | |
(:use [clojure.test])) | |
(defmacro my-macro | |
[x] | |
`~(reverse x)) |
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- ipred [[k v]] | |
(pred/like k v)) | |
(defn- partial-pred [m] | |
"Turn a map into a predicate format understood by cql. IE {:a 1 :b 2} --> (pred/and* (pred/=* :a 1) (pred/=* :b 2))" | |
(apply pred/and* (map ipred m))) | |
(defprotocol MapFindable | |
"A protocol for clojureQL searchable things that can be found using a map interface" | |
(find [this search-map])) |
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
~/scratch/clojurescript$ ./script/bootstrap | |
Fetching Clojure... | |
Copying clojure-1.3.0/clojure-1.3.0.jar to lib/clojure.jar... | |
Cleaning up Clojure directory... | |
Cleaning up Clojure archive... | |
Fetching Google Closure library... | |
Cleaning up Google Closure library archive... | |
Fetching Google Closure compiler... | |
Cleaning up Google Closure compiler archive... | |
Building lib/goog.jar... |
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 sma [n s] | |
{:pre [(pos? n)]} | |
(concat | |
(repeat (dec n) nil) | |
(map #(/ (reduce + %) n) (partition n 1 s)))) |
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
$("#marketList tbody.yui-dt-data") | |
.find('tr') | |
.map(function(_,row){ | |
var $r = $(row); | |
var data = { | |
"name": $r.find(".yui-dt-col-market").text() | |
, "sell": parseFloat($r.find(".yui-dt-col-sell").text()) | |
, "buy": parseFloat($r.find(".yui-dt-col-buy").text()) | |
}; | |
return data; |