Skip to content

Instantly share code, notes, and snippets.

View mudphone's full-sized avatar

Kyle Oba mudphone

View GitHub Profile
- (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;
};
- (void) shrinkFrame {
void (^myBlock)(float);
myBlock = ^(float scale) {
CGRect frame;
frame = self.frame;
frame.size.width /= scale;
frame.size.height /= scale;
self.frame = frame;
};
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
@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)
@mudphone
mudphone / Another-Clojure-Y-Combinator.clj
Created August 1, 2012 09:29
Another Clojure Y-Combinator
;; Y-Combinator in Clojure
;; based on: http://mvanier.livejournal.com/2897.html
;; This is the simple naive implementation.
(defn simple-factorial
"A simple, naive implementation of the factorial function."
[n]
(if (= n 0)
1
(* n (simple-factorial (dec n)))))
@mudphone
mudphone / emacs_clojure_nrepl_setup_20121015.txt
Last active October 11, 2015 17:08
Clojure dev with Lein 2 and nrepl (Swank-less)
= install lein 2
- Do this: https://github.com/technomancy/leiningen
- download lein script, it will boot strap itself
- install on path, rename to lein, chmod 755
- run lein --version
Leiningen 2.0.0 on Java 1.6.0_37 Java HotSpot(TM) 64-Bit Server VM
= Emacs >= 24
- Download latest version: http://emacsformacosx.com, if you want the GUI version
- Or, for CLI, use homebrew
@mudphone
mudphone / .gitconfig
Created January 24, 2013 23:06
A simple .gitconfig file.
[user]
name = <# YOUR NAME #>
email = <# YOUR EMAIL #>
[alias]
co = checkout
st = status
ci = commit
br = branch
sm = submodule
smu = submodule update
@mudphone
mudphone / clojure_dev_lein_nrepl.md
Last active December 12, 2015 02:19
Clojure dev with Lein 2 and nrepl (Swank-less)

Before heading down this path, consider using Emacs Live, which is a nice set of defaults for working with Clojure, Overtone and Quil.

Also, check out this nice write-up on debugging with nREPL.

I also drew inspiration (copied things) from Ryan Neufeld's config, which you should also consider using.

Finally, you can check out my ~/.emacs.d/init.el config on GitHub.

All this as of May, 2013...

@mudphone
mudphone / processing2withEmacs
Last active December 14, 2015 08:49
Processing 2 with Emacs
install Processing (Mac) version 2.0b9
install processing-emacs
$ cd ~/.emacs.d/vendor
$ git clone https://github.com/ptrv/processing2-emacs.git
install processing-java command line utility
- Open Processing.app
- Tools > Install "processing-java"