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 dynamacros.fib) | |
;; Y-Combinator in Clojure | |
;; Based on http://citizen428.net/blog/2010/12/14/clojure-deriving-the-y-combinator-in-7-stolen-steps/ | |
;; This is the simple naive implementation. | |
(defn simple-factorial | |
"A simple, naive implementation of the factorial function." | |
[n] | |
(if (= n 0) |
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
module Remote | |
def remote(host, cmd, no_sudo=false) | |
ssh_cmd = "ssh #{host}" | |
ssh_cmd += " sudo bash" unless no_sudo | |
cmd = %Q[echo "#{cmd}"|#{ssh_cmd}] | |
p "Running: #{cmd}" | |
system cmd | |
end | |
end |
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
- (void) shrinkFrame { | |
void (^myBlock)(float); | |
myBlock = ^(float scale) { | |
CGRect frame; | |
frame = self.frame; | |
frame.size.width /= scale; | |
frame.size.height /= scale; | |
self.frame = frame; | |
}; | |
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
- (void) shrinkFrame { | |
void (^myBlock)(void); | |
myBlock = ^(void) { | |
CGRect frame; | |
frame = self.frame; | |
frame.size.width /= 1.5; | |
frame.size.height /= 1.5; | |
self.frame = frame; | |
}; | |
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
- (void) shrinkFrame { | |
void (^myBlock)(void); | |
myBlock = ^(void) { | |
CGRect frame; | |
frame = self.frame; | |
frame.size.width /= 1.5; | |
frame.size.height /= 1.5; | |
self.frame = frame; | |
}; | |
NewerOlder