Skip to content

Instantly share code, notes, and snippets.

View bogdan's full-sized avatar
💭
Developing everything, fixing everything, delivering everything

Bogdan Gusiev bogdan

💭
Developing everything, fixing everything, delivering everything
View GitHub Profile
class Company < ActiveRecord::Base
STOP_WORDS = %w(a the inc incorporated corp corporated usa us)
include Traits::Dictionary::Core
#
# Associations
#
find app/ config/ lib/ populator/ public/ spec/ -type f -exec sed -i 's/JobApplication/JobOpportunity/g' {}\;
find app/ db/ config/ lib/ populator/ public/ spec/ -type f -exec sed -i 's/job_applications/job_opportunities/g' {} \;
find app/ db/ config/ lib/ populator/ public/ spec/ -type f -exec sed -i 's/job_application/job_opportunity/g' {} \;
find app/ config/ lib/ populator/ public/ spec/ -type f -exec sed -i 's/JobApplication/JobOpportunity/g' {} \;
find app/ config/ lib/ populator/ public/ spec/ -type f -exec sed -i 's/JobOpportunitys/JobOpportunities/g' {} \;
# In order to not spawn suggestions on every update
# perform suggestion if no changes were made in time interval
def suggest_jobs
after_transaction do
Resque.remove_delayed(JobSuggestionWorker, self.owner_id)
Resque.enqueue_at(1.minutes.from_now, JobSuggestionWorker, self.owner_id)
end
end
describe '.visible' do
before :each do
@me = Factory :customer
@friend = Factory :customer
@somebody = Factory :customer
@commentable = Factory :job_opportunity, :owner => @me
@my_comment = Factory :comment, :owner => @me, :commentable => @commentable
@friends_comment = Factory :comment, :owner => @friend, :commentable => @commentable
@private_comment = Factory :comment, :owner => @friend, :commentable => @commentable, :private => true
end
def create_comment_notification
commentable.owner.comment_notifications.create!(:source => self) if commentable.owner
parent.owner.comment_notifications.create!(:source => self) if parent
end
class UserNotifier < BaseNotifier
def registration_confirmation(user_id)
user = User.find(user_id)
subject "StartWire Authentication – Almost Ready To Rock!"
from "robot@#{Settings.default_domain}"
recipients user.email
sent_on Time.now
body "user" => user
end
require 'spec_helper'
describe "Discover" do
let(:named_scope) {
Group.by_char("j")
}
let(:java) { Group.create!(:name => "java") }
let(:json) { Group.create!(:name => "json") }
require 'spec_helper'
describe "Discover" do
let(:named_scope) {
Group.by_char("j")
}
let(:java) { Group.create!(:name => "java") }
let(:json) { Group.create!(:name => "json") }
if defined?(ActiveRecord)
# In order to spec ActiveRecord finders
# Implemented discover custom matcher
#
# :call-seq:
# Class.named_scope.should discover(model1, model2)
# Class.named_scope.should_not discover(model3, model4)
#
# matcher subject should be an instance of ActiverRecord::NamedScope::Scoped or Array
$(document).ready(function() {
{
submit: function(data) {
$('.js-sidebar-profile').replaceWith(data.html)
this.init();
},
init: function() {
$('#sidebar_profile').ajaxSubmit(this.submit);
}