Skip to content

Instantly share code, notes, and snippets.

View jsuchal's full-sized avatar

Jano Suchal jsuchal

View GitHub Profile
# WebPage uses cache??? What the heck is cache in context of a webpage crawling process? It should only crawl pages. You need to inject some dummy cache to prevent caching.
# thumnail generation is an expensive job, thus lazy-loading. But you are not saving already generated thumbnails in cache. :(
# Nice tests.
@jsuchal
jsuchal / results
Created December 31, 2011 01:04 — forked from karmi/tire_http_clients_benchmark.rb
Benchmark Tire gem with RestClient, Curb and Thrift Clients
================================================================================
["RestClient", 5.152005974]
--------------------------------------------------------------------------------
["Curb", 2.073422755]
--------------------------------------------------------------------------------
["Thrift", 3.357725494]
--------------------------------------------------------------------------------
bus = On::Bus.new.
subscribe(DonationReceipt).
subscribe(NotifyAccountingSystem).
subscribe(UpdatePublicStats).
subscribe(LogInternalMetrics).
subscribe(UpdateAnalyticsDashboard).
subscribe(RealtimeViewerUpdate)
def link_to_notifiable(notifiable)
notifiable.link_to_notifiable(self)
end
# concerns/notifiable_presenters.rb
class Answer
def link_to_notifiable(helper)
helper.link_to_answer, question
end
end
@jsuchal
jsuchal / example.rb
Last active August 29, 2015 14:00 — forked from franckverrot/example.rb
class InviteController < ApplicationController
# The controller's responsibility is to build an object graph
# that will do the hard work.
def accept
scenario = InvitationScenario.new
scenario.accept_invite_token_for_user(current_user, params[:token], bus.when(
inviting_succeeded: ->(user) { redirect_to invite.item, notice: "Welcome!" },
inviting_failed: ->(error) { redirect_to '/', alert: "Oopsy!" }
))
#!/bin/bash
VERSION="1.1.1"
PORT="9333"
PWD=`pwd`
mkdir -p ~/elasticsearch/
cd ~/elasticsearch/
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${VERSION}.zip