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 range-without-zero [from to] | |
(filter #(not (= 0 %)) (range from to))) | |
(def my-range (range-without-zero -8 9)) | |
(def t-map-licoresse | |
(let [r (filter #(not (= 0 %)) (range -8 9))] | |
(concat (for [x r] [x -1]) | |
(for [x (reverse r)] | |
[x 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
(use 'clojure.walk) | |
(defmacro with-iota [& body] | |
"Provides the local 'iota' which starts at 0 and automatically self-increments" | |
(let [iota (gensym "whatever-")] | |
`(let [~iota ~(atom -1)] | |
~@(map #(postwalk-replace {'iota `(swap! ~iota inc)} %) body)))) | |
(with-iota | |
(let [a iota |
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
(defvar shortcut-list '(1 2 3 4 5)) | |
(defun unset-numeric-shortcuts (list) | |
(mapcar | |
'(lambda (n) | |
(global-unset-key (read-kbd-macro (format "C-%d" n)))) | |
list)) | |
(unset-numeric-shortcuts shortcut-list) |
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 slime-compilation-finished (result) | |
(with-struct (slime-compilation-result. notes duration successp) result | |
(setf slime-last-compilation-result result) | |
(slime-show-note-counts notes duration successp) | |
(when slime-highlight-compiler-notes | |
;(slime-highlight-notes notes) | |
(growl (format "%s" (second (first notes))) | |
;(run-hook-with-args 'slime-compilation-finished-hook notes) | |
))) |
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 inside-byte [v] | |
(cond | |
(< v 0) 0 | |
(> v 255) 255 | |
:else v)) | |
(defn darker- [color fraction] | |
(let [fr (- 1.0 fraction) | |
red (inside-byte (-> (.getRed color) (* fr) Math/round)) | |
green (inside-byte (-> (.getGreen color) (* fr) Math/round)) |
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
(import 'java.awt.Color) | |
(def *default-color-fraction* 0.2) | |
(def *default-blend-fraction* 0.5) | |
(defn- format-hex [c] | |
(str "#" (format "%02x%02x%02x" | |
(.getRed c) | |
(.getGreen c) |
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
// log every category | |
[[L4Logger rootLogger] setLevel:[L4Level all]]; | |
// send log messages to console | |
L4ConsoleAppender *consoleAppender=[[[L4ConsoleAppender alloc] initTarget:YES withLayout: [L4Layout simpleLayout]] autorelease]; | |
[[L4Logger rootLogger] addAppender: consoleAppender]; | |
L4Logger *theLogger = [L4Logger loggerForClass:[L4FunctionLogger class]]; | |
[theLogger setLevel:[L4Level debug]]; | |
// | |
log4Info(@"The logging system has been initialized."); |
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
/// | |
- (ConfigureCellBlock)dimmedCell { | |
return [[^(UITableViewCell *cell) { | |
cell.backgroundColor = [self colorFor:@"sub.cell.background"]; | |
cell.selectionStyle = UITableViewCellSelectionStyleNone; | |
} copy] autorelease]; | |
} | |
/// | |
- (ConfigureBadgeBlock)standardBadge { |
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
import Cocoa | |
struct Constraint { | |
typealias T = (attribute: CAConstraintAttribute, relativeTo:String, relatedAttribute: CAConstraintAttribute, offset: CGFloat) | |
let data: T | |
func create() -> CAConstraint { | |
let newConstraint: AnyObject! = CAConstraint.constraintWithAttribute(data.attribute, relativeTo: data.relativeTo, attribute: data.relatedAttribute, offset: data.offset) | |
return newConstraint as CAConstraint | |
} |
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
import Cocoa | |
struct Constraint { | |
typealias T = (attribute: CAConstraintAttribute, relativeTo:String, relatedAttribute: CAConstraintAttribute, offset: CGFloat) | |
let data: T | |
func create() -> CAConstraint { | |
let newConstraint: AnyObject! = CAConstraint.constraintWithAttribute(data.attribute, relativeTo: data.relativeTo, attribute: data.relatedAttribute, offset: data.offset) | |
return newConstraint as CAConstraint | |
} |
OlderNewer