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
a[href ^= 'http']:not([href *= 'example_domain.']) { | |
background: transparent url(arrow.png) no-repeat center right; | |
padding-right: 16px; | |
} |
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
c = ActiveRecord::Base.connection | |
c.tables.collect do |t| | |
columns = c.columns(t).collect(&:name).select {|x| x.ends_with?("_id" || x.ends_with("_type"))} | |
indexed_columns = c.indexes(t).collect(&:columns).flatten.uniq | |
unindexed = columns - indexed_columns | |
unless unindexed.empty? | |
puts "#{t}: #{unindexed.join(", ")}" | |
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
Handlebars.registerHelper('debugger', function(optionalValue) { | |
console.log('Current Context'); | |
console.log('===================='); | |
console.log(this); | |
if (optionalValue) { | |
console.log('Value'); | |
console.log('===================='); | |
console.log(optionalValue); | |
} |
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 ApplicationHelper | |
include ActionView::Helpers::AssetTagHelper | |
def image_tag(source, options = {}) | |
if options[:retina] | |
options['data-at2x'] = path_to_image(source.split('.').join('@2x.')) | |
options.tap { |h| h.delete(:retina) } | |
else | |
options['data-no-retina'] = '' | |
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
Coupon.bonus.each { |b| b.update_attributes(total_tutor_cost_cents: 750) if b.total_tutor_cost_cents == 1500 } |
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
context 'real use cases, lasted less than min duration' do | |
it 'elapsed seconds = 0, lesson duration = 30min, residual seconds = 45min, pay MIN' do | |
create(:purchased_credit, credit: bundle, student: student, residual_seconds: 45*60, expire_at: Time.now+1.year, status: :paid) | |
expect(lesson_service.lesson_started?).to be_falsey | |
expect(lesson_service.lasted_less_than_min_duration?).to be_truthy | |
expect(lesson_service.lasted_less_than_duration?).to be_truthy | |
expect(lesson_service.show_min_duration?).to be_truthy | |
expect(lesson_service.max_duration).to eql lesson.duration | |
expect(lesson_service.close_and_pay!('min')).to be_truthy |
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
lock '3.2.1' | |
# Configuration | |
set :application, 'travel-mesh' | |
set :repo_url, "git@github.com:NetBookingCom/travel-mesh.git" | |
set :executener, fetch(:user) | |
set :admin_executener, fetch(:user) | |
set :use_sudo, false | |
set :normalize_asset_timestamps, false |
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
{ | |
"network_infos":{ | |
"search_details":{ | |
"search_id":{ | |
"$oid":"57b5bac04d616306b9030000" | |
}, | |
"search_type":"Accomodation" | |
}, | |
"results":[ | |
{ |
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
/usr/local/bsmart/current/log/activations.log { | |
daily | |
missingok | |
rotate 7 | |
compress | |
delaycompress | |
notifempty | |
copytruncate | |
} |
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
Tutor.all.each do |tutor| | |
tutor.generate_tutor_search_cache | |
tutor.rates_count = tutor.feedbacks.positive.count - tutor.feedbacks.negative.count | |
tutor.opinions_count = tutor.feedbacks.with_opinion.count | |
tutor.save | |
end |
OlderNewer