Skip to content

Instantly share code, notes, and snippets.

View b-murphy's full-sized avatar
😁

Brendan b-murphy

😁
  • Product Story
  • London, England
View GitHub Profile
$('#someSpecialLinkToBasket').on('click', function(e) {
fbq('track', 'InitiateCheckout', {
basket_value: 1000,
});
});
defmodule HelloPhoenix.Memcached.Supervisor do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, [])
end
def init([]) do
pool_options = [
name: {:local, :memcached_pool},
# what's the expectation for the require within constant (non global state)
# like this?
require "mary.rb"
Bob = Module.new {}
def self.find_or_next(id)
find(id)
rescue ActiveRecord::RecordNotFound
if (id == last.id + 1) then raise ActiveRecord::RecordNotFound; end
find(id+1)
end
sudo apt-get update
sudo apt-get install docker.io
sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
curl -L https://github.com/orchardup/fig/releases/download/0.4.1/linux > /usr/local/bin/fig
chmod +x /usr/local/bin/fig
@b-murphy
b-murphy / gist:11285152
Created April 25, 2014 10:41
issue with cropping image : filepicker
ADF.SpaceImageUploadView = Ember.View.extend(
didInsertElement: ->
_this = this
this.$("input.image_uploader").on('click', ->
storePath = "/space/#{_this.get('controller.model.id')}/images/"
filepicker.pickAndStore({multiple: true, folders: true, mimetype: 'image/*', isWriteable: false}, {path: storePath, container: 'adoorfor'}, (data) ->
_.each(data, (rawData) ->
_this.resizeImage(rawData)
)
)
@b-murphy
b-murphy / ummm.rb
Last active December 28, 2015 13:29
Need help with this.... there must be a better way.....
require 'pry'
RSpec.describe " example iterator " do
class ATest
def call(args = {})
args[:a] = "this was at A"
args[:b] = "this should not happen"
args[:c] = "this should not happen"
export PATH="/Users/brendanmurphy/bin:$PATH:."
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
export PATH="/usr/local/bin:$PATH:/usr/local/bin"
export PATH="/usr/local/heroku/bin:$PATH"
# Enthuse
alias enthuse="cd ~/work/Enthuse"
@b-murphy
b-murphy / artwork.rb
Created April 21, 2013 20:03
for lewis.
require 'rest_client'
require 'json'
class Artwork
def fetch(query)
api_key = '82a7531b6438492cd9e967442e5b12c8'
album = RestClient.get("http://ws.audioscrobbler.com/2.0/?method=album.search&album=#{query}&api_key=#{api_key}&format=json")
album = JSON.parse(album)
results = album.fetch('results').fetch('albummatches').fetch('album')[0].fetch('image').last.fetch('#text')
print results.to_s + "\n"
@b-murphy
b-murphy / .bash_profile
Created February 25, 2013 11:03
bash profile.
export PATH="/Users/brendanmurphy/bin:$PATH:."
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
alias be="bundle exec"
alias rdb="bundle install; bundle exec rake db:drop; bundle exec rake db:create; bundle exec rake db:migrate; bundle exec rake db:test:prepare"
alias rdbi="rdb; import_backup; be rake db:migrate; be rake db:test:prepare"
# rails
alias rs="rails s"