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 / 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

require "capybara"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium, app)
sess.visit("/")
__END__
@supairish
supairish / gist:5872581
Created June 26, 2013 23:09
Paypal Payflowpro example
@secure_token_id = UUID.generate.gsub('-', '').slice(0, 25)
current_user.update_attribute(:paypal_token_id, @secure_token_id)
paypal_params = {'PARTNER' => 'PayPal', 'VENDOR' => PAYPAL_USER, 'USER' => PAYPAL_USER, \
'PWD' => PAYPAL_MANAGER_PASSWORD, 'TRXTYPE' => 'S', 'AMT' => cost, 'CREATESECURETOKEN' => 'Y', \
'SECURETOKENID' => @secure_token_id
}.to_param
paypal_params += "&RETURNURL=#{paypal_success_url}&ERRORURL=#{paypal_error_url}&SILENTPOSTURL=#{paypal_silent_post_url}&CANCELURL=#{subscribe_url}"
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
@supairish
supairish / gist:748c85552b2f7047a36a
Created May 30, 2014 23:15
Whitelist request throttling in Nginx?
http {
map $whitelist $limit {
default $binary_remote_addr;
1 "";
}
limit_conn_zone $limit zone=conn_limit_per_ip:10m;
limit_req_zone $limit zone=req_limit_per_ip:10m rate=5r/s;
server {
@supairish
supairish / gist:819adda554dd757aa492
Created September 7, 2014 20:14
Far future expires headers for Rails assets
location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}