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 sudoku.core | |
(:use clojure.set) | |
(:use [clojure.contrib.seq :only [find-first]])) | |
(defn select-row [vek i] | |
(let [start (- i (rem i 9)) | |
end (+ start 9)] | |
(set (for [e (range start end)](vek e))))) | |
(defn select-column [vek i] |
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
package dream; | |
import sleep.Sleeper; | |
public class Dream { | |
int num = 0; | |
public void dream(final Sleeper s) { | |
if (num++ < 10) { | |
Thread thread = new Thread(new Runnable() { | |
public void run() { |
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 code-dojo.core | |
(:use [code-dojo.core] [clojure.math.combinatorics] [clojure.java.io :only (reader)]) | |
(:use [speclj.core])) | |
(def dictionary | |
(map #(.toLowerCase %) | |
(line-seq (reader "english_words.txt")))) | |
(defn same-length [len coll] | |
(filter #(= len (count %)) coll)) |
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
(defun l0ad-theme (name) | |
(interactive | |
(list | |
(intern (completing-read "Load custom theme: " | |
(mapcar 'symbol-name (custom-available-themes)))))) | |
((load-theme name t))) |
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 size 50) | |
(def avalanche-threshold 3) | |
(def empty-table (vec (repeat size (vec (repeat size 0))))) | |
(defn adjacent-cells [x y] | |
(filter #(and (not (neg? (first %))) (not (neg? (second %))) (< (first %) size) (< (second %) size)) | |
(list [x (inc y)] [x (dec y)] [(inc x) y] [(dec x) y]))) | |
(defn avalanche [table cells-to-increment avalanches] |
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 sandbox.fibo-dojo) | |
(def fib (cons 1 (cons 2 (lazy-seq (map + (rest fib) fib))))) | |
(def indexes (iterate inc 0)) | |
(defn cons-one? [xs prev] | |
(if (seq xs) | |
(if (and (= 1 prev) (= (first xs) prev)) true | |
(cons-one? (rest xs) (first xs))))) |
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 sandbox.fibo-dojo) | |
(def fib (cons 1 (cons 2 (lazy-seq (map + (rest fib) fib))))) | |
(def indexes (iterate inc 0)) | |
(defn cons-one? [xs prev] | |
(if (seq xs) | |
(if (and (= 1 prev) (= (first xs) prev)) true | |
(recur (rest xs) (first xs))))) |
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
(defun compile-run-tests (arg) | |
(interactive "P") | |
(let ((oldbuf (current-buffer))) | |
(save-buffer) | |
(nrepl-load-current-buffer) | |
(nrepl-switch-to-relevant-repl-buffer nil) | |
(insert "(run-specs)") | |
(nrepl-return) | |
(unless arg | |
(switch-to-buffer-other-window oldbuf)))) |
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
(defun eval-popup (arg) | |
(interactive "P") | |
(let* ((result (nrepl-eval (nrepl-last-expression))) | |
(val (plist-get result :value)) | |
(err (plist-get result :stderr))) | |
(pos-tip-show | |
(or val err)))) | |
(eval-after-load 'clojure-mode | |
'(define-key clojure-mode-map (kbd "\e\ee") 'eval-popup)) |
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
!/usr/bin/env ruby | |
if ARGV.length < 4 | |
puts "Usage: enc-flac artist year album picture" | |
exit | |
end | |
artist = ARGV[0] | |
date = ARGV[1] | |
album = ARGV[2] |
OlderNewer