Skip to content

Instantly share code, notes, and snippets.

View philsmy's full-sized avatar

Phil Smy philsmy

View GitHub Profile
@philsmy
philsmy / make.log
Created September 9, 2011 11:07
error from rvm install attempt of ruby 1.8.7
[2011-09-09 12:59:08] make
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c array.c
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c bignum.c
bignum.c: In function ‘rb_big_unpack’:
bignum.c:314: warning: right shift count >= width of type
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c class.c
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c compar.c
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c dir.c
/usr/bin/gcc-4.2 -a
@philsmy
philsmy / ability.rb
Created August 23, 2011 09:30
our ability class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user
if user.role? :super_admin
can :manage, :all
else
@philsmy
philsmy / arel_or.rb
Created August 18, 2011 10:20
or scopes - add this to your model to be able to or scopes together (eg: Model.or(Model.scope1, Model.scope2). Stolen and adapted from fake_arel
__or_fn = lambda do |*scopes|
where = []
joins = []
includes = []
# for some reason, flatten is actually executing the scope
scopes = scopes[0] if scopes.size == 1
scopes.each do |s|
w = []
s.where_clauses.each do |where_clause|
#!/bin/sh
mkdir -p ~/development/src
cd ~/development/src
if [ -d ImageMagickInstall ]
then
# remove old ImageMagickInstall directory if it exists
rm -rf ImageMagickInstall
fi
mkdir ImageMagickInstall
cd ImageMagickInstall
server {
listen 80;
server_name domain1.ca;
return 301 https://www.domain1.com$request_uri;
}
server {
listen 80;
server_name domain1.com;
return 301 https://www.domain1.com$request_uri;