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
{"rollup"=> | |
{"total_points"=>3490, | |
"pillars"=> | |
{"activity"=> | |
{"points"=>2400, "percent_of_goal_met"=>400.0, "percent_of_total"=>68.8}, |
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
==> cat dev1/etc/vm.args | |
## Name of the riak node | |
-name dev1@127.0.0.1 | |
## Cookie for distributed erlang. All nodes in the same cluster | |
## should use the same cookie or they will not be able to communicate. | |
-setcookie riak | |
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive | |
## (Disabled by default..use with caution!) |
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
==> cat dev1/etc/app.config | |
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- | |
%% ex: ft=erlang ts=4 sw=4 et | |
[ | |
%% Riak Client APIs config | |
{riak_api, [ | |
%% pb_backlog is the maximum length to which the queue of pending | |
%% connections may grow. If set, it must be an integer >= 0. | |
%% By default the value is 5. If you anticipate a huge number of | |
%% connections being initialised *simultaneously*, set this number |
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
# Returns an array of matches that occur during the tournament and have a | |
# game_type of 100 | |
def matches | |
values = Match.where(:game_type => ::Match::GAME_TYPE_TRN).where( | |
"starts_at >= ? and starts_at < ?", self.start_time, self.end_time).order( | |
"id ASC") | |
# Limit matches to max rounds | |
if self.rounds.present? | |
values = values[0..(self.rounds.to_i - 1)] |
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
xml = '<?xml version="1.0" encoding="utf-8"?><mdx version="4.0" xmlns="responseSimple" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></mdx>' | |
parsed = Nokogiri.parse(xml) | |
parsed.xpath('/mdx').present? | |
# => false | |
xml = '<?xml version="1.0" encoding="utf-8"?><mdx></mdx>' | |
parsed = Nokogiri.parse(xml) | |
parsed.xpath('/mdx').present? | |
# => true |
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
s = "hello\xdf".force_encoding("ASCII-8BIT") | |
s.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "") |