This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ Sharer.const_get(:Twitter) | |
$ Sharer::Twitter | |
=> Sharer::Twitter | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Env | |
class EnvKeyError < StandardError; end | |
def self.method_missing(method_name, *arguments, &block) | |
if method_name.to_s =~ /\?\z/ | |
!! env_value(method_name) { false } | |
else | |
env_value(method_name) { raise EnvKeyError, method_name } | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Env | |
class EnvKeyError < StandardError; end | |
def self.method_missing(method_name, *arguments, &block) | |
env_value(method_name) { raise EnvKeyError, method_name } | |
end | |
def self.respond_to?(method_name, include_private = false) | |
env_value(method_name) | |
true | |
rescue StandardError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserCreator | |
attr_reader :user | |
def initialize(params = nil) | |
@params = params | |
end | |
def call | |
@user = User.create(@params) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"page": {"title": "Noomea","publish_on_tumblr": "yannck","message": "Hello Martin De Wulf", "status": "published","mobile": true,"blocks": [{"type": "bigtitle","content": "Noomea","order": 0,"value": "Noomea"},{"type": "photo","content": "uploads/2013/05/24/4e8505eb0f6c764773001235/A999247D-90FA-4B9C-9842-6DE82A4678CC.jpg","order": 1},{"type": "photo","content": "uploads/2013/05/24/4e8505eb0f6c764773001235/880C2CB0-1ABA-462E-948D-44C535E83409.jpg","order": 2},{"type": "photo","content": "uploads/2013/05/24/4e8505eb0f6c764773001235/7B388554-76B9-4011-BB51-479EF948B53F.jpg","order": 3},{"type": "photo","content": "uploads/2013/05/24/4e8505eb0f6c764773001235/F7C6C2F5-40E5-4659-B94D-C5A355BBD2DC.jpg","order": 4}]}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.feed_items.aggregate( | |
{ | |
$match: { | |
page_id: ObjectId("51937305736c8af00c0002f6") | |
} | |
}, | |
{ | |
$sort : { | |
created_at: 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TravelJob < Struct.new(:trip_id, :job_id) | |
def perform | |
if trip | |
TravelRefresh.fetch(trip, job_id) | |
end | |
end | |
private | |
def trip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cgi' | |
require 'digest' | |
class PageThumb | |
NORMAL_SIZE = :normal | |
SMALL_SIZE = :small | |
DEFAULT_DELAY = 4 | |
DEFAULT_VIEWPORT = "1024x768" | |
NORMAL_WIDTH = 480 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDelegate | |
attr_reader :base_controller, :window | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
NewRelicAgent.startWithApplicationToken 'AA670ce7f87593469e6d4f0988245a1739d2892f99' | |
Crashlytics.startWithAPIKey '1de0b454fef30734d9f8881dc88854c927e78f86' | |
UINavigationBar.appearance.setBackgroundImage 'depressed.png'.uiimage, forBarMetrics:UIBarMetricsDefault | |
UINavigationBar.appearance.setTitleTextAttributes({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Heroku | |
HEROKU_API = "https://api.heroku.com" | |
def login(username, password, &block) | |
body = { username: username, password: password } | |
@callback = lambda do |response| | |
block.call(HerokuResponse.new(response)) if block_given? | |
end | |
BW::HTTP.post("#{HEROKU_API}/login", { headers: headers, payload: body }, &@callback) |