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
var Search = Backbone.Model.extend({ | |
setSelectedTagIds: function(ids) { | |
clearTimeout(this.timeout); | |
var model = this; | |
model.set({ selected_tag_ids: ids, update_type: 'tags' }); | |
model.timeout = setTimeout(function() { | |
model.fetch(); | |
}, 1000); | |
}, |
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
source 'http://rubygems.org' | |
gem 'rails', '3.0.5' | |
gem 'rails3-generators' | |
gem 'pg' | |
gem 'silent-postgres' | |
gem 'devise' | |
gem 'cancan' | |
gem 'inherited_resources', '~> 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
# Usage | |
# body { | |
# background: url(asset_path('background.png')) #FFFFFF; | |
# } | |
module Sass::Script::Functions | |
include Sprockets::Helpers::RailsHelper | |
def asset_path(path) | |
assert_type path, :String | |
Sass::Script::String.new(super(path.value), :string) | |
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
= tabs do |manager| | |
= manager.tab :about, :name => "About this Expert" do | |
%p.trader-half | |
= simple_format(@profile.expert_description) | |
%ul.info-list | |
- @profile.contact_services_ordered_by_group.each do |service| | |
%li= render_service(service) | |
.cl | |
%ul.i-blocks.trader-half | |
%li= twitter_share |
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
var Tag, activeTags, inactiveTags, suggestedTags; | |
Application.Models.Tag = Backbone.Model.extend({}); | |
Application.Models.Business.Tag = Application.Models.Tag.extend({ | |
activate: function() { | |
var manager = this.get('manager'); | |
if (!manager) return false; | |
manager.activateTag(this); | |
}, | |
deactivate: function() { |
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
claims = customer.claims.where(:deal_id => business.deal_ids) | |
last_ticket_creation_date = customer.tickets.where(:id.ne => id).order(:created_at.desc).first.try(:created_at) | |
claims = claims.where(:created_at.gt => tickets.last.created_at) if last_ticket_creation_date | |
deal_ids = claims.map(&:deal_id).uniq | |
deals_scope = business.deals.open_up.where(:id.in => deal_ids) | |
loyality_points = [deals_scope.open_up.max(:price), deals_scope.special.max(:loyalty_bonus), flyer ? flyer.value : 0].max | |
customer_relation = customer.customer_relations.where(:business => business).first | |
customer_relation.increment!(:gift_points, loyality_points) if customer_relation |
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
Application.Views.Network.RelationControl = (function () { | |
var view = { events: {} }; | |
var toggleMap = [ | |
[['accept_profile', 'decline_profile'], ['friendship_request_block']], | |
[[{ post: 'friend_profile' }, { ajaxDelete: 'unfriend_profile' }], ['trust_block', 'distrust_block']], | |
[[{ post: 'subscribe_profile' }, { ajaxDelete: 'unsubscribe_profile' }], ['subscribe_block', 'unsubscribe_block']], | |
[['accept_employment', 'decline_employment'], ['employment_request_block']], | |
[[{'post':'create_employment'}, {'ajaxDelete':'remove_employment'}], ['employment_block']], | |
[['promote_to', 'demote_from'], ['employment_role_block']] | |
]; |
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 Api | |
extend self | |
def repository(owner, name) | |
fetch("repos/show/#{owner}/#{name}")['repository'] | |
end | |
def organization(name) | |
fetch("organizations/#{name}/public_members") | |
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
require 'haml' | |
class ErbEngine < Haml::Engine | |
def push_script(text, preserve_script, in_tag = false, preserve_tag = false, | |
escape_html = false, nuke_inner_whitespace = false) | |
push_text "<%= #{text.strip} %>" | |
end | |
def push_silent(text, can_suppress = false) | |
push_text "<% #{text.strip} %>" |
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
'use strict'; | |
class Executor { | |
constructor(maxTasksInParallel) { | |
this._maxTasksInParallel = maxTasksInParallel; | |
this._currentTasks = 0; | |
this._queue = []; | |
} | |
start(task) { |