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 logic.once | |
(:refer-clojure :exclude [==]) | |
(:use [clojure.core.logic]) | |
(:require [clojure.core.logic.fd :as fd])) | |
(defne occurs-noneo [x xs] | |
([x []]) | |
([x [y . ys]] | |
(!= y 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
Infortunately I am unable at accept this pull request because it fails one of my unit tests. | |
test.job> (fact "job is in the correct city" | |
(let [job {:company "Amazon" :location :seattle}] | |
(:location job) => :austin)) | |
FAIL "job is in the correct city" at (form-init8310622436901647370.clj:3) | |
Expected: :austin | |
Actual: :seattle |
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
(def matches | |
{:a {:a "foo" :b "bar"} | |
:b {:a "blue" :b {:a "fred" :b "bob"}}}) | |
(defn winner [node] | |
(if (map? node) | |
(:winner node) | |
node)) | |
(defn select-winner [node aorb] |
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 find-timer [timer-name] | |
(timers/timer ["APPNAME" "timer" (name timer-name)])) | |
(defmacro with-timer [timer-name & body] | |
`(let [timer# (find-timer ~timer-name)] | |
(timers/time! timer# | |
(do ~@body)))) |
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
<Resource name="jdbc/QuoteDB" auth="Container" type="javax.sql.DataSource" | |
maxActive="100" maxIdle="30" maxWait="10000" username="SA" password="" | |
driverClassName="org.hsqldb.jdbc.JDBCDriver" url="jdbc:hsqldb:hsql://localhost:9001/" /> |
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
public class Marker { | |
public String color; | |
public String tip; | |
public Marker(String color, String tip) { | |
this.color = color; | |
this.tip = tip; | |
} | |
public void write() { |
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
upstream myapp { | |
server 127.0.0.1:8000; | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
proxy_pass http://myapp; | |
proxy_read_timeout 180; |
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 jaspertest.core | |
(:import [net.sf.jasperreports.engine JasperFillManager JasperExportManager JasperCompileManager]) | |
(:require [clojure.java.io :as io])) | |
(defn java-hashmap [results-map] | |
(let [hashmap-reducer (fn [m [k v]] (doto m (.put (name k) v)))] | |
(reduce hashmap-reducer (java.util.HashMap.) results-map))) | |
(def mock-data |
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
public class Game { | |
// https://gist.github.com/orb/ | |
public static void main(String[] args) { | |
char[][] board = new char[20][40]; | |
initBoard(board); | |
int x = 5; | |
int y = 5; | |
int xspeed = 1; | |
int yspeed = -1; |
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
-- exercise 1 | |
toDigitsRev n = if (n <= 0) | |
then [] | |
else (n `mod` 10) : (toDigitsRev (n `div` 10)) | |
toDigits = reverse . toDigitsRev | |
-- exercise 2 |
OlderNewer