Skip to content

Instantly share code, notes, and snippets.

@mudphone
mudphone / gist:3223392
Created August 1, 2012 03:31
Y-Combinator in Clojure
(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)
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
- (void) shrinkFrame {
void (^myBlock)(float);
myBlock = ^(float scale) {
CGRect frame;
frame = self.frame;
frame.size.width /= scale;
frame.size.height /= scale;
self.frame = frame;
};
- (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;
};
- (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;
};