Skip to content

Instantly share code, notes, and snippets.

@xavierRiley
xavierRiley / rackspace-server-setup
Created November 18, 2011 16:28
Setting up nginx, unicorn, memcached, upstart on a Rackspace Cloud Ubunutu 10.04
http://brandontilley.com/2011/01/29/serving-rails-apps-with-rvm-nginx-unicorn-and-upstart.html
but ...
Rvm commands have changed slightly. Create a normal user first then;
http://beginrescueend.com/rvm/install/
Follow multi user install
@xavierRiley
xavierRiley / sample-vhosts.conf
Created January 5, 2012 16:39
Sample vhost for php sites
<VirtualHost *:80>
ServerName SITE_URL
ServerAlias SITE_IP *.SITE_URL
DocumentRoot /var/www/SITE_URL/PUBLIC_FOLDER
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
@xavierRiley
xavierRiley / gist:1570253
Created January 6, 2012 11:49
Setting MIME type of images on S3 recursively using Fog gem
connection.directories.first.files.each {|file| if file.key.match(/jpg$/)
file.content_type = "image/jpg";
file.acl="public-read"
file.save
puts file.key
}; nil
}
@xavierRiley
xavierRiley / my_template.rb
Created February 7, 2012 20:55 — forked from nesquena/my_template.rb
Kyan Custom Admin Template for Padrino
project :test => :rspec, :orm => :activerecord, :adapter => :postgres, :mock => :none, :script => :jquery, :renderer => :erb, :stylesheet => :none, :admin_renderer => :erb
# include additional generators
inject_into_file destination_root('config/boot.rb'), "\# include additional generators\nPadrino::Generators.load_paths << Padrino.root('generators', 'kyan_admin_page_generator.rb')\nPadrino::Generators.load_paths << Padrino.root('generators', 'kyan_admin_generator.rb')\n\n", :before => "Padrino.load!"
say "Cloning custom generators from git@github.com:xavierRiley/Kyan-Padrino-Admin-Generators.git", :red
remove_dir destination_root('generators')
run "git clone git@github.com:xavierRiley/Kyan-Padrino-Admin-Generators.git " + destination_root('generators')
#generate :model, "account username:string password:string"
@xavierRiley
xavierRiley / hack.sh
Created April 25, 2012 07:15 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
@xavierRiley
xavierRiley / clojure_scales.clj
Created August 10, 2012 13:05
Clojure experiment
(defn get-dir [x]
(let [penul (first (rest (reverse x)))])
(let [final (last x)])
(when (>
(first (rest (reverse x)))
(last x)) (print "down"))
(when (>
(last x)
(first (rest (reverse x)))) (print "up"))
@xavierRiley
xavierRiley / gist:3426429
Created August 22, 2012 14:59 — forked from flyingmachine/gist:3390402
Installing Ruby after upgrading from Snow Leopard to Mountain Lion

After you've done the steps below it will be as if you did an upgrade rather than a clean install. Your home directory will be there, as will your applications.

  1. Back up system to an external HD (I used Super Duper)
  2. Install mountain lion clean: http://eggfreckles.net/notes/installing-mountain-lion-clean/
  3. At the end of the install, transfer files back from my external HD
  4. Remove everything in /usr/local with sudo rm -Rf /usr/local/*
  5. Follow these instructions: http://jfire.io/blog/2012/03/02/xcode-4-dot-3-homebrew-and-ruby/
  6. I had trouble with ree/1.8.7 so I had to follow these instructions: http://stackoverflow.com/questions/11664835/mountain-lion-rvm-install-1-8-7-x11-error/11666019#11666019
@xavierRiley
xavierRiley / index.txt
Created September 1, 2012 20:32 — forked from gus/index.txt
Ruby/Clojure analogs
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
@xavierRiley
xavierRiley / stream-tests.clj
Created December 14, 2012 12:52
Some ideas for the big scale exercise in Clojure
(defn remove-consecutive-duplicates [coll]
(let [shifted-coll (cons nil coll)]
(remove nil? (map (fn [x y] (if (not= x y) x)) coll shifted-coll))))
(remove-consecutive-duplicates
(seq
(filter even?
(take 32
(cycle
(concat