-
Zero downtime during upgrades and scaling out system (such as zero seconds downtime, while app still runs)
-
Highly Scalable with Terabytes of data with high performance and low cost with shards
-
Automatic Replica Set member take-over in case of failing primary, with automatic recovery for returning hosts.
-
Automatic promotion to primary and de promotion for any member of a replica set based on performance and latency.
-
Journaling, allows safe recovery in case of hard-disk failure.
-
Strong consistency, "Afford to loose data" in mongoDB is myth. Data is not lost, it's only not persisted due to failures on the developers code.
-
When Sharding is not feasible, different Documents (rails models) can be on different Replica sets (different database or set) altogether, since there are no joins in Mongo.
-
Background indexes.
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
/ file: app/views/admin/users/_search.html.haml | |
#panel_contents | |
= form_for(admin_users_path, method: :get) do |f| | |
.filter_form_field.filter_string | |
= label_tag :query, "Full Text Search" | |
= text_field_tag :query, params[:query], { placeholder: "Keyword to search" } | |
.buttons | |
= submit_tag "Search" | |
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
namespace :workers do | |
namespace :clockwork do | |
desc "Stop clockwork" | |
task :stop do | |
on roles(:app) do | |
within release_path do | |
with rails_env: fetch(:rails_env) do | |
execute :bundle, :exec, :clockworkd, "-c lib/clockwork.rb --pid-dir=#{cw_pid_dir} --log-dir=#{cw_log_dir} stop" | |
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
# add to home .bashrc | |
if [[ $- != *i* ]] ; then | |
# Shell is non-interactive. Be done now! | |
return | |
fi | |
safe_term=${TERM//[^[:alnum:]]/?} | |
match_lhs="" | |
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" |
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
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
interactive = auto | |
ui = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow |
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
/Users/fred/.rvm/gems/ruby-2.0.0-p353/gems/rest-2.7.1/lib/rest/wrappers/base_wrapper.rb:21:in `rescue in post_file': HTTP 400 Error: In JSON, unexpected end of JSON input at position 0. (Rest::Wrappers::RestClientExceptionWrapper) | |
from /Users/fred/.rvm/gems/ruby-2.0.0-p353/gems/rest-2.7.1/lib/rest/wrappers/base_wrapper.rb:6:in `post_file' | |
from /Users/fred/.rvm/gems/ruby-2.0.0-p353/gems/rest-2.7.1/lib/rest/client.rb:219:in `block in post_file' | |
from /Users/fred/.rvm/gems/ruby-2.0.0-p353/gems/rest-2.7.1/lib/rest/client.rb:142:in `perform_op' | |
from /Users/fred/.rvm/gems/ruby-2.0.0-p353/gems/rest-2.7.1/lib/rest/client.rb:218:in `post_file' | |
from /Users/fred/.rvm/gems/ruby-2.0.0-p353/gems/iron_core-1.0.3/lib/iron_core/client.rb:258:in `post_file' | |
from /Users/fred/.rvm/gems/ruby-2.0.0-p353/gems/iron_worker_ng-1.2.0/lib/iron_worker_ng/api_client.rb:43:in `codes_create' | |
from /Users/fred/.rvm/gems/ruby-2.0.0-p353/gems/iron_worker_ng-1.2.0/lib/iron_worker_ng/client.rb:112:in `codes_create' | |
from /Users/fred/.rvm/ge |
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
# Example: | |
# > Date.parse_thai '20 ม.ค. 2557' | |
# => Mon, 20 Jan 2014 | |
# > Date.parse_thai '20 ม.ค. 2554' | |
# => Thu, 20 Jan 2011 | |
# > Date.parse_thai "26 ก.พ. 2556" | |
# => Tue, 26 Feb 2013 | |
# > Date.parse_thai "26 กรกฎาคม 2556" | |
# => Fri, 26 Jul 2013 | |
# > Date.parse_thai "กรกฎาคม 14, 2556" |
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
# lib/models/keen_publisher.rb | |
require 'celluloid' | |
class KeenPublisher | |
include Celluloid | |
def initialize(name, status) | |
@name = name | |
@status = status | |
end | |
def publish | |
Keen.publish(@name, @status) |
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 'celluloid' | |
class IronQueueWorker | |
include Celluloid | |
def initialize | |
@token = "your-token" | |
@old_project_id = "source-project-id" | |
@new_project_id = "source-project-id" | |
@old_iron_cache = IronCache::Client.new(token: @token, project_id: @old_project_id) | |
@new_iron_cache = IronCache::Client.new(token: @token, project_id: @new_project_id) |
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
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
interactive = auto | |
ui = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow |