This file contains hidden or 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 NativeSerializer | |
def encode | |
value.inspect | |
end | |
def decode(value) | |
eval(value) | |
end | |
end |
This file contains hidden or 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
package org.fxposter.wavelets; | |
import com.sun.imageio.plugins.bmp.BMPImageReader; | |
import sun.awt.image.ByteInterleavedRaster; | |
import javax.imageio.ImageIO; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.color.ColorSpace; | |
import java.awt.image.*; |
This file contains hidden or 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 Asset < ActiveRecord::Base | |
belongs_to :owner, :polymorphic => true | |
class User < self | |
has_attached_file :image, :styles => { :original => "160x160>" } | |
before_create :destroy_previous_asset | |
end | |
protected | |
def destroy_previous_asset |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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']] | |
]; |
OlderNewer