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
<ul> | |
<% @users.each do |user| %> | |
<li> | |
<%= user.name %> | |
<% if (orders = user.orders_in_timespan(@start_date, @end_date)).any? %> | |
<ul> | |
<% orders.each do |order| %> | |
<li><%= order.number %></li> | |
<% end %> | |
</ul> |
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
redis.zadd('scores:20120701', 10, 'alice') | |
redis.zadd('scores:20120701', 7, 'bob') | |
redis.zadd('scores:20120701', 5, 'carol') | |
# resulting ranking: | |
# 1 - alice | |
# 2 - carol | |
# 3 - bob | |
redis.zadd('scores:20120702', 7, 'alice') | |
redis.zadd('scores:20120702', 9, 'bob') |
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
h = { a: 1, b: 2 } | |
def foo(a:, b:) | |
[a, b] | |
end | |
foo(h) #=> [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
{ | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": ["s3:ListBucket" ], | |
"Resource": [ "arn:aws:s3:::BUCKETNAME" ] | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject"], |
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
module Trailblazer; end | |
module My; end | |
class Trailblazer::Operation | |
def self.inherited(klass) | |
*mod_names, klass_name = klass.name.split('::') | |
mod = const_get(mod_names.join('::')) | |
mod.define_singleton_method(klass_name) do |*args| |
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
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs | |
# retry all failed Resque jobs except the ones that have already been retried | |
# This is, for instance, useful if you have already retried some jobs via the web interface. | |
Resque::Failure.count.times do |i| | |
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present? | |
end | |
# retry all :) | |
Resque::Failure.count.times do |i| |
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
tmp[master]% convert logo.jpg -format png -colorspace srgb -profile ../vendor/profiles/sRGBColorSpaceProfile.icm logo.png | |
tmp[master]% rm logo.png | |
tmp[master]% cp logo.jpg logo.png | |
tmp[master]% mogrify -format png -colorspace srgb -profile ../vendor/profiles/sRGBColorSpaceProfile.icm logo.png | |
mogrify: improper image header `../vendor/profiles/sRGBColorSpaceProfile.icm' @ error/png.c/ReadPNGImage/3981. |
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
class Product < ActiveRecord::Base | |
define_index do | |
# rest of the index ... | |
has merchant_id | |
has merchant.company, :as => :merchant_name, :type => :string | |
has brand_id, :type => :integer | |
has brand.name, :as => :brand_name, :type => :string |
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
2016-08-01T09:24:58.489044+00:00 heroku[router]: at=info method=GET path="/" host=example.com request_id=e8e2f6a9-b50b-4054-8efc-fb35457558e6 fwd="192.168.0.1" dyno=web.1 connect=0ms service=16ms status=302 bytes=1389 |
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
@keyframes animation-1 { | |
/* whatever */ | |
} | |
@keyframes animation-2 { | |
/* whatever */ | |
} | |
@keyframes animation-3 { | |
/* whatever */ |
NewerOlder