http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table
| ; inspired from http://stackoverflow.com/questions/3906831/how-do-i-generate-memoized-recursive-functions-in-clojure | |
| (defmacro memoize-fn | |
| "Produces a memoized anonymous function that can recursively call itself." | |
| [fn-name & fn-args] | |
| `(with-local-vars | |
| [~fn-name (memoize | |
| (fn ~@fn-args))] | |
| (.bindRoot ~fn-name @~fn-name) | |
| @~fn-name)) |
| ;; Linked list implementation | |
| ;; I compile it like this on Mac OS X: | |
| ; | |
| ; llvm-as linked-list.ll | |
| ; llc linked-list.bc | |
| ; as linked-list.s -o linked-list.o | |
| ; ld /usr/lib/crt1.o linked-list.o -o linked-list -lSystem -macosx_version_min 10.6 | |
| ;; Type aliases | |
| %free_func = type void (i8*)* |
| (ns friends-relationship-twitter.core | |
| (:require [borneo.core :as neo] | |
| [oauth.client :as oauth])) | |
| (def oauth-consumer (oauth/make-consumer "KEY" | |
| "SECRET" | |
| "https://api.twitter.com/oauth/request_token" | |
| "https://api.twitter.com/oauth/access_token" | |
| "https://api.twitter.com/oauth/authorize" |
| load 'deploy/assets' | |
| namespace :deploy do | |
| namespace :assets do | |
| desc 'Run the precompile task locally and rsync with shared' | |
| task :precompile, :roles => :web, :except => { :no_release => true } do | |
| %x{bundle exec rake assets:precompile} | |
| %x{rsync --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{host}:#{shared_path}} | |
| %x{bundle exec rake assets:clean} | |
| end |
| // Version 1. Simple recursive function. Blows the stack for large nodes. | |
| function replace(node, from, to) { | |
| switch (node.type) { | |
| case IF: | |
| return { | |
| type: IF, | |
| test: replace(node.test, from, to), | |
| then: replace(node.then, from, to), | |
| else: replace(node.else, from, to) | |
| }; |
| (begin | |
| (require-extension gl) | |
| (require-extension glut) | |
| (require-extension glu) | |
| (glut:InitDisplayMode (+ glut:DOUBLE glut:RGBA glut:DEPTH)) | |
| (glut:InitWindowSize 400 300) | |
| (glut:CreateWindow "gl hello world")) | |
| (begin |
| require 'rubygems' | |
| require 'pg' | |
| require 'eventmachine' | |
| module Subscriber | |
| def initialize(pg) | |
| @pg = pg | |
| end | |
| def notify_readable |
| #lang racket/base | |
| ;; By http://www.reddit.com/user/p4bl0 at http://paste.fulltxt.net/FZ4-HeULc | |
| ;; `racket -il readline -t http-client.rkt` | |
| ;; then you can use (M "/path/...") where M can be get, post, put, delete. | |
| ;; When authenticated, you can logout using (logout). | |
| ;; The host and port can be changed using set!. | |
| (require racket/tcp |
http://guides.rubyonrails.org/migrations.html
| # 1. Install from NetInst CD, via Ethernet, minimal set of packages, use syslinux boot loader! | |
| # 2. Initialize Pacman, hit random keys during init | |
| pacman-key --init | |
| pacman-key --populate archlinux | |
| # 3. Install X and Awesome WM | |
| pacman -Sy xorg-server xorg-xinit xorg-utils xorg-server-utils xterm awesome xf86-video-vesa | |
| # 4. Install nvidia drivers |