Skip to content

Instantly share code, notes, and snippets.

View ys's full-sized avatar
💭
Doing stuff with computers

Yannick Schutz ys

💭
Doing stuff with computers
View GitHub Profile
$ Sharer.const_get(:Twitter)
=> Twitter
$ Sharer::Twitter
=> Sharer::Twitter
$ Twitter
=> Twitter
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
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
class UserCreator
attr_reader :user
def initialize(params = nil)
@params = params
end
def call
@user = User.create(@params)
{"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}]}}
db.feed_items.aggregate(
{
$match: {
page_id: ObjectId("51937305736c8af00c0002f6")
}
},
{
$sort : {
created_at: 1
}
class TravelJob < Struct.new(:trip_id, :job_id)
def perform
if trip
TravelRefresh.fetch(trip, job_id)
end
end
private
def trip
require 'cgi'
require 'digest'
class PageThumb
NORMAL_SIZE = :normal
SMALL_SIZE = :small
DEFAULT_DELAY = 4
DEFAULT_VIEWPORT = "1024x768"
NORMAL_WIDTH = 480
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({
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)