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
;; Burn down chart, input something like "200 175 160 155 152" | |
;; This relies on Dejcartes which is out in "Super pre-alpha". | |
;; Much credit and praise to Chouser for ping-ponging with me on this. | |
(require '[com.markmfredrickson.dejcartes :as chart]) | |
(import '(org.jfree.chart ChartFrame)) | |
(defn make-window [title chart] |
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 queue (ref (with-meta | |
clojure.lang.PersistentQueue/EMPTY | |
{:tally 0}))) | |
(def seats 3) | |
(defn debug | |
[msg n] | |
(println msg (apply str (repeat (- 35 (count msg)) \space)) n) | |
(flush)) |
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 dk.bestinclass.ikeda | |
(:import (javax.swing JFrame JPanel) | |
(java.awt Color Graphics) | |
(java.awt.image BufferedImage) | |
(java.awt.event MouseListener))) | |
;= Definitions | |
(def x-axis [-10 10]) | |
(def y-axis [-10 10]) |
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/perl | |
use CGI":standard";chdir($0=~s~[^/]*$~~);import_names("x");while($x::t){open$f,">$x::t.r";print$f "$x::l$/$x::v$/".($x::i?$x::i:localtime);close$f;CGI::delete(split(//,~~tlvi));$x::t=0}@r=$x::s?<*$x::s*.r>:<*.r>;print header,start_html,start_form,textfield(-name=>'s',-value=>"search"),submit,end_form,start_form,textfield(-name=>~~t,-value=>"title"),textfield(-name=>~~l,-value=>"link"),hidden(-name=>v,-value=>0),submit,end_form,ul li([sort{$s=sub{$_=$_[0];s~<.*?>~~g;$_};$s->($b)cmp$s->($a)}map{open$f,$_;@a=<$f>;chomp@a;m/(.*)\.r/;(a{href=>"?t=$1&l=$a[0]&i=$a[2]&v=".($a[1]+1)},"^").$a[1].(a{-href=>"?t=$1&l=$a[0]&i=$a[2]&v=".($a[1]-1)},"v")." ".(a{-href=>$a[0]},$1).br.small"added: ".$a[2]}@r]),end_html | |
# Note: you may need to chmod the directory containing the script to 777. | |
# Warning: DO NOT host on a public website. It will open up all sorts of nasty security holes. |
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/perl4 | |
# Horrible, horrible, horrible edit of someone's | |
# even more horrible "reddit clone in 4 lines of perl". | |
use CGI ':standard'; | |
$dir = File::Basename::dirname( $0 ); | |
chdir $dir; |
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
; Copyright (c) Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
; which can be found in the file epl-v10.html at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. | |
(set! *warn-on-reflection* 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
(ns com.wangdera.slideshow | |
(:import (java.io File) | |
(javax.imageio ImageIO) | |
(javax.swing JFrame JPanel Timer) | |
(java.awt Dimension Frame Color))) | |
(def imagelist (atom [])) | |
(def running (atom true)) | |
(defmacro props [obj & properties] |
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
(reduce #(assoc %1 %2 (inc (get %1 %2 0))) {} | |
(make-a-seq of-IPs | |
(line-seq (File. ip-log)) |
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 do-board [[w h] & body] | |
`(let [w# (int ~w) h# (int ~h)] | |
(loop [~'i (int 1)] | |
(when (< ~'i h#) | |
(loop [~'j (int 1)] | |
(when (< ~'j w#) | |
(do ~@body) | |
(recur (unchecked-inc ~'j)))) | |
(recur (unchecked-inc ~'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
;sample use idea: | |
(defn mapx | |
"Returns a lazy sequence consisting of the result of applying f to the | |
set of first items of each coll, followed by applying f to the set | |
of second items in each coll, until any one of the colls is | |
exhausted. Any remaining items in other colls are ignored. Function | |
f should accept number-of-colls arguments." | |
[f coll] | |
(gen-iter iter [f seq-cell] |
OlderNewer