Skip to content

Instantly share code, notes, and snippets.

View supairish's full-sized avatar
🏂
Shreddin

Chris Irish supairish

🏂
Shreddin
View GitHub Profile
@supairish
supairish / arel_or.rb
Created January 30, 2012 08:16 — forked from philsmy/arel_or.rb
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|
@supairish
supairish / ubuntu_steps.sh
Created March 25, 2012 04:05 — forked from johnrees/_ubuntu_steps.sh
Standard Rails 3.* setup for Ubuntu 10.04 LTS 32
# As root user
# Update the OS
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
# Setup Hostname & TimeZone
echo "{{HOSTNAME}}" > /etc/hostname
hostname -F /etc/hostname
dpkg-reconfigure tzdata
@supairish
supairish / application.rb
Created May 18, 2012 00:18 — forked from steve9001/application.rb
Rails middleware to provide information about errors during requests
module MyApp
class Application < Rails::Application
if Rails.env == 'test'
require 'diagnostic'
config.middleware.use(MyApp::DiagnosticMiddleware)
end
end
end
@supairish
supairish / installation.sh
Created June 6, 2012 16:56 — forked from mikhailov/installation.sh
nginx+passenger (real production config)
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.0.15.tar.gz
$ tar xzvf ./nginx-1.0.15.tar.gz
$ rm -f ./nginx-1.0.15.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
$ tar xzf openssl-1.0.1c.tar.gz && rm -f openssl-1.0.1c.tar.gz
namespace :attachments do
task :migrate_to_s3 => :environment do
require 'aws/s3'
# Load credentials
s3_options = YAML.load_file(File.join(Rails.root, 'config/s3.yml')).symbolize_keys
bucket = s3_options[:bucket_name]
# Establish S3 connection
@supairish
supairish / gist:4685494
Last active December 12, 2015 00:39
Flash embed
<a href="#feeling-better-intro" rel="facebox" style="margin-bottom:20px" title="Click here.">
<img src="https://s3.amazonaws.com/production.media.goalistics.com/medias/927/Progressive_Muscle_Relaxation_Video_Overview.jpg" style="float:left">
</a>
<div id="feeling-better-intro" style="display:none">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" height="500" width="700">
<param name="movie" value="url-path-to-some-swf-file.swf">
<embed src="url-path-to-some-swf-file.swf" height="500" width="700">
</object>
</div>
@supairish
supairish / gist:4685523
Last active December 12, 2015 00:39
MP4 embed
<a href="#thinking-better-intro" rel="facebox" style="margin-bottom:20px" title="Click here">
<img src="https://s3.amazonaws.com/production.media.goalistics.com/medias/691/video-promo-thinking-better.jpg" style="float:left">
</a>
<div id="thinking-better-intro" style="display:none">
<source id="source" src="https://s3.amazonaws.com/production.media.goalistics.com/videos/Progressive+Muscle+Relaxation+2.mp4" type="video/mp4">
</div>
@supairish
supairish / gist:4980239
Last active December 13, 2015 21:48
Lead Screening Questionaire
1. How did you hear about us / find us?
2. Who is the audience for this app?
3. Do you have a feature specification or design document currently prepared that we can see? Or do you need our services to help create this type of document?
4. Have you ever had software built before?
5. Are you currently working with a designer or marketing agency for design/branding?
0. rails new my_store && cd my_store
1. to Gemfile
remove gem 'rais', gem 'jquery-rails'
and add folowing rows:
-------------------------------------------------------------------------------------------------------
gem 'liquid', :git => 'git://github.com/Shopify/liquid.git'
gem 'spree', :git => "git://github.com/spree/spree.git", :branch => "1-3-stable"
gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git'
gem 'refinerycms', :git => "git://github.com/refinery/refinerycms.git"#, :branch => "2-0-stable"

Add necessary libs

$ su
$ apt-get install autoconf automake autotools-dev build-essential bison bzip2 curl git libreadline5 libsqlite3-0 sqlite3 libsqlite3-dev libxml2-dev libmysqlclient-dev libreadline5-dev libruby openssl libssl-dev zlib1g zlib1g-dev zlibc vim libv8-dev nodejs

Add rvm

$ \curl -L https://get.rvm.io | bash -s stable --ruby

Add rvm initializer in .bashrc