I hereby claim:
- I am richardtifelt on github.
- I am richardj (https://keybase.io/richardj) on keybase.
- I have a public key ASCTDLdqpgddnMkLhWo4_glnCZdqVHB0Pg89Y4ymyT9P1wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Cloudinary::Migrator.new( | |
db_file: "tmp/cloudinary_resource_images.db", | |
threads: 1, | |
retrieve: ->(id) { | |
resource = Resource.find(id) | |
if (resource.size || resource.image.size) > 19.megabytes | |
file = open(resource.image.url) | |
`convert #{file.path} -quality 85 jpg:-` | |
else | |
resource.url |
alias testbot='bundle exec rake testbot:rspec 2>&1 | tee /tmp/testbot-output.txt | grep "^\(Finished.*\.$\|rspec\|\d\+ examples\)"' |
class MyCommand < Flower::Command | |
respond_to %w(testing test) | |
def self.respond(command, message, sender, flower) | |
# Do something with "flower" | |
flower.say("Only testing") | |
end | |
def self.description | |
"Text that describes your command. It's used in the built-in Help command." |
module Mynewsdesk | |
module Helpers | |
def self.compute_asset_host(path) | |
host_config = Mynewsdesk::Application.config.asset_host | |
if host_config.respond_to?(:call) && host_config.arity == 1 | |
host_config.call(path) | |
else | |
raise "Please set up config.asset_host with a proc that takes one argument" | |
end | |
end |
document.observe("dom:loaded",function(){ | |
initEventTrackingLinks(); | |
}); | |
var initEventTrackingLinks = function(){ | |
$$(".event-tracking").each(function(elm){ | |
elm.observe("click", function(evt){ | |
var category = elm.readAttribute("data-event-category"); | |
var action = elm.readAttribute("data-event-action"); | |
var label = elm.readAttribute("data-event-label"); |
class Class | |
def memoize(*methods) | |
methods.each do |method_name| | |
safe_method_name = method_name.to_s.gsub(/(\!|\?)/, '_') | |
class_eval(" | |
alias :'#{safe_method_name}_without_memo' :'#{method_name}' | |
def #{method_name} | |
if defined?(@#{safe_method_name}) | |
@#{safe_method_name} |
require 'httparty' | |
module DetectLanguage | |
class GoogleTranslate | |
include HTTParty | |
base_uri 'http://ajax.googleapis.com/ajax/services/language' | |
format(:json) | |
def self.detect_language str |
require 'httparty' | |
class Api::Bitly | |
include HTTParty | |
base_uri 'api.bit.ly' | |
basic_auth 'username', 'password' | |
format :json | |
def self.shorten(url) | |
response = get('/shorten', :query => required_params.merge(:longUrl => url)) |