Skip to content

Instantly share code, notes, and snippets.

function Animal() {
this.eyes = 2;
this.legs = 4;
this.name = "Animal";
this.mutate = function () {
this.eyes += 1;
this.legs += 1;
this.name = this.name + "...";
};
}
@cormacrelf
cormacrelf / graph
Created March 18, 2012 01:16
graphing
function Graph(config){
this.canvas = config.canvas;
this.minX = config.minX;
this.minY = config.minY;
this.maxX = config.maxX;
this.maxY = config.maxY;
this.context = this.canvas.getContext("2d");
this.centerY = Math.abs(this.minY / (this.maxY - this.minY)) * this.canvas.height;
this.centerX = Math.abs(this.minX / (this.maxX - this.minX)) * this.canvas.width;
@cormacrelf
cormacrelf / moregraphs
Created March 18, 2012 02:51
moregraphs
var canvas = document.getElementById('c');
canvas.width = 600;
canvas.height = 600;
var ctx = canvas.getContext('2d');
var draw = function(x,y){
ctx.fillRect(x,600-y,1,1);
};
ctx.fillRect(300,0,1,600);
stoichiometry:
m_origin = 8.5e7 g
M_origin = 55.845
origin = 2
target = 3
M_target = 28
Target mass: m_target = m_origin/M_origin * target/origin * M_target
@cormacrelf
cormacrelf / gist:2224299
Created March 28, 2012 06:37
Crash every time I launch, within 4 seconds.
Process: Cloud [3000]
Path: /Applications/Cloud.app/Contents/MacOS/Cloud
Identifier: com.linebreak.CloudAppMacOSX
Version: 1.5.3 (1.5.3)
App Item ID: 417602904
App External ID: 4781889
Code Type: X86-64 (Native)
Parent Process: launchd [214]
Date/Time: 2012-03-28 17:36:07.342 +1100
#!/bin/zsh
# Usage: copy-rtf [file]
#
# Copies Pygmentize's RTF output of a source file to the clipboard after making it 36pt Monaco.
#
# Copy straight into an "Auto-Shrink" text box in Keynote for efficient code highlighting in a Coding presentation.
# Depends on [Pygments](http://pygments.org/) being installed in your $PATH...
# try `gem install pygmentize` for a standalone Ruby installation.
#!/bin/zsh
# Usage: copy-rtf [file]
#
# Copies Pygmentize's RTF output of a source file to the clipboard after making it 36pt Monaco.
#
# Copy straight into an "Auto-Shrink" text box in Keynote for efficient code highlighting in a Coding presentation.
# Depends on [Pygments](http://pygments.org/) being installed in your $PATH...
# try `gem install pygmentize` for a standalone Ruby installation.
==> Downloading http://ftpmirror.gnu.org/mit-scheme/stable.pkg/9.0.1/mit-scheme-c-9.0.1.tar.gz
Already downloaded: /Users/cormac/Library/Caches/Homebrew/mit-scheme-9.0.1.tar.gz
/usr/bin/tar xf /Users/cormac/Library/Caches/Homebrew/mit-scheme-9.0.1.tar.gz
==> etc/make-liarc.sh --disable-debug --prefix=/usr/local/Cellar/mit-scheme/9.0.1 --mandir=/usr/local/Cellar/mit-scheme/9.0.1/share/man
etc/make-liarc.sh --disable-debug --prefix=/usr/local/Cellar/mit-scheme/9.0.1 --mandir=/usr/local/Cellar/mit-scheme/9.0.1/share/man
run_cmd: ./configure --prefix=/private/tmp/homebrew-mit-scheme-9.0.1-gN1X/mit-scheme-c-9.0.1/src/boot-root --enable-native-code=c --disable-host-scheme-test
checking whether make sets $(MAKE)... yes
checking build system type... i386-apple-darwin11.3.0
checking host system type... i386-apple-darwin11.3.0
checking for gcc... /usr/bin/clang
@cormacrelf
cormacrelf / gist:2848970
Created June 1, 2012 05:04
Count to a small integer!
>,<++++++[>--------<-]>
[>>+<<-]
+++++++
[>+++++++<-]
>>[<.+>-]
<[-]

Fun fun fun!

I am here.