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
server { | |
listen 80 default; | |
server_name _; | |
root /opt/apache-tomcat-7.0.53/webapps/ROOT; | |
location / { | |
proxy_pass http://localhost:8080; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_max_temp_file_size 0; |
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
description "Tomcat Server" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 | |
limit nofile 32000 32000 | |
console output | |
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
# ElasticSearch Service | |
description "ElasticSearch" | |
start on (net-device-up | |
and local-filesystems | |
and runlevel [2345]) | |
stop on runlevel [016] |
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 'https://rubygems.org' | |
# Core libraries | |
gem 'rake' | |
gem 'activesupport' | |
gem 'bson_ext' | |
# Add gems related with content parsing | |
gem 'nokogiri' |
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
before(:all) { @stuff = create :stuff } | |
let!(:stuff) { @stuff } | |
before { Stuff.stub(:find).with(stuff.id.to_s).and_return(stuff) } |
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
module Concerns | |
module LazyAttribute | |
extend ActiveSupport::Concern | |
included do | |
class_attribute :lazy_attributes | |
end | |
module ClassMethods | |
def attr_lazy(name, &logic_impl) |
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
namespace :somestuffs do | |
desc 'Importing some big stuff that requies lotta network stuff' | |
task :import | |
file, tasks = ENV['FILE'], Queue.new | |
# Parse out CSV file and retrieve each row and queue them up | |
# for further processing. | |
# | |
# Keeping it a thread allows us to let this process continue while other | |
# threads are not in RUNNING state. |
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
# Integrate with ActiveMerchant and Expose active merchant related methods. | |
# | |
# This module also includes Validator for ActiveMerchant. | |
module Concerns::AsActiveMerchant | |
extend ActiveSupport::Concern | |
included do | |
validates_with Validators::ActiveMerchant, if: :cc_number_is_changed? | |
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
class Message | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
field :subject, type: String | |
field :content, type: String | |
belongs_to :replied_to, class_name: 'Message', inverse_of: :replies, touch: true | |
belongs_to :sender, class_name: 'User', inverse_of: :sent_messages | |
has_many :replies, class_name: 'Message', inverse_of: :replied_to |
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
def handle_action_created(action) | |
if action.from.kind_of?(Source) | |
$redis.lpush( | |
"#{self.class.name}:#{self.id}", | |
[action.from.node.id, action.from.node.neo_id].join(":") | |
) | |
end | |
end | |
# Perhaps we could do |