This file contains 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
if Rails.env.development? | |
def after_task(task_name, &new_task) | |
old_task = Rake.application.instance_variable_get('@tasks').delete(task_name.to_s) | |
desc old_task.full_comment | |
task task_name do | |
old_task.invoke | |
new_task.call | |
end | |
end |
This file contains 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
form do |f| | |
f.inputs "Challenge" do | |
f.input :name | |
f.input :about | |
f.input :starts | |
f.input :ends | |
end | |
f.inputs do | |
f.has_many :time_sets do |time_set| |
This file contains 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 'feedzirra' | |
# fetching a single feed | |
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing") | |
# feed and entries accessors | |
feed.title # => "Paul Dix Explains Nothing" | |
feed.url # => "http://www.pauldix.net" | |
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing" | |
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0" |
This file contains 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
[ | |
[ 0] [ | |
[0] "'TO\"s service returns error: Invalid endDate value=\"28.01.2016\". Before startDate.'", | |
[1] 1 | |
], | |
[ 1] [ | |
[0] "'TO\"s service returns error: Invalid endDate value=\"27.06.2016\". Before startDate.'", | |
[1] 1 | |
], | |
[ 2] [ |
This file contains 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
[ | |
[ 0] [ | |
[0] "'Unexpected character encountered while parsing value: Q. Line 1, position 4.. Content filename: C:\\SletatRu\\ChewerClient\\Temp\\adb56229-dd2c-4290-b2ed-d021a9aea18a.html'", | |
[1] 1 | |
], | |
[ 1] [ | |
[0] "'Error on TO\"s online: Object reference not set to an instance of an object.'", | |
[1] 1 | |
], | |
[ 2] [ |
This file contains 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
{ | |
"_index": "offers", | |
"_type": "tour", | |
"_id": "5b95619cd3434ce770705171cae70e8e", | |
"_score": 1, | |
"_source": { | |
"duration": 4, | |
"default_group_field": "730.1.2016-06-15.4.2.0", | |
"start_date": "2016-06-15", | |
"cost": 51745, |
This file contains 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 "dry/transaction" | |
class CreateUser | |
include Dry::Transaction | |
# step without rollback should not fail the whole process | |
# its optional | |
step :process | |
step :track, rollback: :rollback_track | |
step :persist |
This file contains 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
{ | |
by_hotel: { | |
terms: { | |
size: 50, | |
field: :hotel_id | |
}, | |
aggs: { | |
by_provider: { | |
terms: | |
{ |
This file contains 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
def ff! &block | |
raise ::LocalJumpError, "No block given" unless block_given? | |
Process.detach(fork &block) | |
end | |
# Demo | |
def test_ff | |
puts "start" | |
(1..100).each do |i| | |
puts i |