Skip to content

Instantly share code, notes, and snippets.

@cracell
cracell / gist:1318386
Created October 27, 2011 00:00
Rails VIM Cheatsheet

Rails VIM Cheatsheet

  • :A #Switch to alternate file (usually the test)
  • :Rview the_view #Interface for views
  • :Rcontroller the_controller #Interface for controllers
  • :Runittest string #Unit tests
$(".menu ul li").live('click', function(){
//show the loading bar
showLoading();
//load selected section
switch(this.id){
case "home":
navmenu.load("navmenu.html #zhome", hideLoading);
break;
case "our-team":
navmenu.load("navmenu.html #zour-team", hideLoading);
@cracell
cracell / gist:2407621
Created April 17, 2012 17:25
Git Commands and You: A Self Help Guide with Fuzzy Pictures (Work in progress)
Pull a remote branch
git pull #To learn about the branch
git checkout -b newdesign origin/newdesign #To actually pull said branch and check it out
@cracell
cracell / gist:2431636
Created April 20, 2012 20:29
Timezone handling JavaScript Library
Should use Olsen files or something equilent to know the timezone offsets for different regions.
Should not overload Date but be able to convert into it.
Should be able to addDays (maybe not...but we need this)
@cracell
cracell / dl.js
Last active December 15, 2015 23:39
The has offers direct link code from https://media.go2speed.org/assets/js/dl.js but patched to work asynchronously.
var hasoffers_aff_id = getUrlVars()["aff_id"];
var hasoffers_offer_id = getUrlVars()["offer_id"];
var hasoffers_source = getUrlVars()["source"];
var hasoffers_aff_sub = getUrlVars()["aff_sub"];
var hasoffers_aff_sub2 = getUrlVars()["aff_sub2"];
var hasoffers_aff_sub3 = getUrlVars()["aff_sub3"];
var hasoffers_aff_sub4 = getUrlVars()["aff_sub4"];
var hasoffers_aff_sub5 = getUrlVars()["aff_sub5"];
var hasoffers_aff_ref = getUrlVars()["aff_ref"];
entity = Entity.find_by uuid: '8bae8fc0-53ce-0135-381b-36241789ce63'
publisher = AmazonSnsPublisher.new(
Figaro.env.AWS_SNS_BASE_ARN,
"wm-entity-master-#{Rails.env}-models"
)
PublishObject.new(entity, publisher).call