Skip to content

Instantly share code, notes, and snippets.

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
@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"];
@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 / 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
$(".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: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
@cracell
cracell / gist:1317905
Last active September 27, 2015 19:08
VIM Cheatsheet (A Work in progress)

VIM Cheatsheet

Remember VIM is all about combining commands. These are just the basics with a few combination examples.

Tutor - vimtutor from command line

Insert Mode

  • i - start insert mode at cursor
  • I - insert at the beginning of the line
@cracell
cracell / gist:1305046
Created October 21, 2011 21:36
BASH Cheat sheet
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W Delete the word before the cursor
@cracell
cracell / gist:1284914
Created October 13, 2011 17:46
Platform Interface Pattern/Idea

Perfect World of Web Development

About This

This writeup is about where I see web development going, where I want it to go and where I think it should go but it shouldn't.

About Me (To understand my perspective)

Platform Interface Pattern

Don't lock things in. But give an obvious path for beginners. Locking things makes evolution to better tools more difficult. Giving options makes getting this done more difficult and time consuming.

@cracell
cracell / gist:1236369
Created September 22, 2011 23:44
mozilla-release/gfx/cairo/cairo/src/cairo-matrix.c
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either