Skip to content

Instantly share code, notes, and snippets.

View catharinejm's full-sized avatar
🐶

Catharine Manning catharinejm

🐶
View GitHub Profile
$ rvm update
rvm 1.0.11 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]
env: bash: No such file or directory
__rvm_run:28: command not found: touch
__rvm_run:30: command not found: date
__rvm_run:31: command not found: tee
env: bash: No such file or directory
env: bash: No such file or directory
irb(1.9.2): if false
?> x = 5
?> end
==========> nil
irb(1.9.2): x
==========> nil
brew install -v emacs --cocoa:
==> Build Environment
CC: /usr/bin/cc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CFLAGS: -O3 -w -pipe
CXXFLAGS: -O3 -w -pipe
MAKEFLAGS: -j4
==> Downloading http://ftp.gnu.org/pub/gnu/emacs/emacs-23.3.tar.bz2
@catharinejm
catharinejm / gist:949200
Created April 29, 2011 23:13
Somthing crazy
;; This works
(defn ^:dynamic foo [] "foo")
(def o (proxy [Object] []
(toString [] (foo))))
(str o) ;=> "foo"
(binding [foo (fn [] "inside binding")] (str o)) ;=> "inside binding"
@catharinejm
catharinejm / gist:1196418
Created September 6, 2011 02:26
inner function closure in C
#include <stdlib.h>
#include <stdio.h>
int(*outer(int val))() {
int inner() {
return val;
}
return inner;
}
@catharinejm
catharinejm / gist:5297300
Last active December 15, 2015 17:38
C arg stuff
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#ifndef __COUNTER__
#error "Your C compiler doesn't support __COUNTER__. Try GCC >= 4.3 or Clang"
#endif
#define __GENSYM2(x,y) x ## y
#define __GENSYM1(x,y) __GENSYM2(x,y)
@catharinejm
catharinejm / gist:5423139
Created April 19, 2013 20:50
Terrible hackery
(eval-after-load 'nrepl
'(progn
(add-hook 'nrepl-mode-hook (lambda () (paredit-mode +1)))
(define-key nrepl-mode-map (kbd "RET") (lambda ()
(interactive)
(if (eobp)
(funcall 'nrepl-return)
(flet ((nrepl-input-complete-p (&rest args) nil))
(funcall 'nrepl-return)))))))
(defn pairs-seq [m]
(->> (keys m)
(mapcat #(partition 2 (interleave (repeat %) (get m %))))))
(defn subset [m n]
(reduce #(update-in %1 [(first %2)] (fnil conj []) (second %2)) {}
(take n (pairs-seq m))))
(def m1 {:x [1 2] :y [3 4] :z [5]})
@catharinejm
catharinejm / lwjgl-timer-example.clj
Last active December 20, 2015 08:29
LWJGL Timing example in Clojure
;; Java Version: http://lwjgl.org/wiki/index.php?title=LWJGL_Basics_4_(Timing)#Example
(ns lwjgl-tutorial.timer-example
(:import [org.lwjgl LWJGLException Sys]
[org.lwjgl.input Keyboard]
[org.lwjgl.opengl Display DisplayMode GL11]))
(defn init-gl! []
(GL11/glMatrixMode GL11/GL_PROJECTION)
(GL11/glLoadIdentity)
#!/usr/bin/env bash
set -e
curl -L https://github.com/Originate/heroku-ruby200p247-openssl101e/raw/master/openssl-1.0.1e.tgz > /tmp/openssl-1.0.1e.tgz
mkdir -p /app/vendor/openssl
tar zxf /tmp/openssl-1.0.1e.tgz -C /app/vendor/openssl
mkdir -p /app/vendor/ruby
autoconf