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 account_id_32(getRequest) | |
players_list(getRequest).map do |x| | |
{ id: x["account_id"], | |
hero_id: x["hero_id"], | |
player_slot: x["player_slot"] | |
} | |
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
require 'json' | |
require 'pp' | |
require 'open-uri' | |
class SteamApi | |
def self.match_history(match_id) | |
JSON.parse(open("https://api.steampowered.com/IDOTA2Match_#{match_id}/GetMatchHistory/V001/?matches_requested=1&key=D53A0505A0582BF91829407EE0ED54E2").read) | |
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
require 'httparty' | |
class SteamApi | |
include HTTParty | |
base_uri "https://api.steampowered.com" | |
default_params key: 'D53A0505A0582BF91829407EE0ED54E2' | |
def self.match_history(match_id) | |
get("/IDOTA2Match_#{match_id}/GetMatchHistory/V001/?matches_requested=1").parsed_response | |
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
player_balance = 1000 | |
player_skill_ids = [] #store course id for skills learned | |
COURSES = [ | |
{ id: 1, name: 'Earth', price: 200, instructor: "Kwame", days: 8 }, | |
{ id: 2, name: 'Fire', price: 300, instructor: "Wheeler", days: 5 }, | |
{ id: 3, name: 'Wind', price: 150, instructor: "Linka", days: 7 }, | |
{ id: 4, name: 'Water', price: 225, instructor: "Gi", days: 6 }, | |
{ id: 5, name: 'Heart', price: 250, instructor: "Ma-Ti", days: 8 } | |
] |
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
>> require 'chronic' | |
SyntaxError: /Library/Ruby/Gems/1.8/gems/chronic-0.10.1/lib/chronic/parser.rb:93: undefined (?...) sequence: /(?<=:\d{2}|:\d{2}\.\d{3})\-(\d{2}:?\d{2})\b/ | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require' | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require' | |
from /Library/Ruby/Gems/1.8/gems/chronic-0.10.1/lib/chronic.rb:4 | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `gem_original_require' | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `require' | |
from (irb):1 |
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
reznet_production=> explain analyze SELECT "reservations".* FROM "reservations" WHERE (lower(last_name) like 'bulson%') ORDER BY updated_at desc LIMIT 20 OFFSET 0; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=18094.87..18094.92 rows=20 width=1053) (actual time=0.071..0.072 rows=2 loops=1) | |
-> Sort (cost=18094.87..18108.03 rows=5264 width=1053) (actual time=0.069..0.069 rows=2 loops=1) | |
Sort Key: updated_at | |
Sort Method: quicksort Memory: 26kB | |
-> Bitmap Heap Scan on reservations (cost=142.38..17954.80 rows=5264 width=1053) (actual time=0.051..0.056 rows=2 loops=1) | |
Filter: (lower((last_name)::text) ~~ 'bulson%'::text) | |
-> Bitmap Index Scan on index_reservations_on_last_and_first_names (cost=0.00..141.07 rows=5264 width=0) (actual t |
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
reznet_production=> explain analyze SELECT "reservations".* FROM "reservations" WHERE (lower(last_name) like 'lin%') ORDER BY updated_at desc LIMIT 20 OFFSET 0; | |
QUERY PLAN | |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=18090.99..18091.04 rows=20 width=1053) (actual time=11.089..11.093 rows=20 loops=1) | |
-> Sort (cost=18090.99..18104.14 rows=5263 width=1053) (actual time=11.088..11.089 rows=20 loops=1) | |
Sort Key: updated_at | |
Sort Method: top-N heapsort Memory: 51kB | |
-> Bitmap Heap Scan on reservations (cost=142.37..17950.94 rows=5263 width=1053) (actual time=1.173..7.815 rows=2266 loops=1) | |
Filter: (lower((last_name)::text) ~~ 'lin%'::text) | |
-> Bitmap Index Scan on index_reservations_on_last_and_first_names (cost=0.00..141.06 rows=5263 width= |
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
reznet_production=> explain analyze SELECT "reservations".* FROM "reservations" WHERE (lower(last_name) like 'lin%') ORDER BY updated_at desc LIMIT 20 OFFSET 0; | |
QUERY PLAN | |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=18090.99..18091.04 rows=20 width=1053) (actual time=11.089..11.093 rows=20 loops=1) | |
-> Sort (cost=18090.99..18104.14 rows=5263 width=1053) (actual time=11.088..11.089 rows=20 loops=1) | |
Sort Key: updated_at | |
Sort Method: top-N heapsort Memory: 51kB | |
-> Bitmap Heap Scan on reservations (cost=142.37..17950.94 rows=5263 width=1053) (actual time=1.173..7.815 rows=2266 loops=1) | |
Filter: (lower((last_name)::text) ~~ 'lin%'::text) | |
-> Bitmap Index Scan on index_reservations_on_last_and_first_names (cost=0.00..141.06 rows=5263 width= |
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
reznet_production=> explain analyze SELECT "reservations".* FROM "reservations" WHERE (lower(last_name) like 'lin%') ORDER BY updated_at desc LIMIT 20 OFFSET 0; | |
QUERY PLAN | |
----------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=159102.95..159103.00 rows=20 width=1053) (actual time=1220.328..1220.336 rows=20 loops=1) | |
-> Sort (cost=159102.95..159116.11 rows=5263 width=1053) (actual time=1220.326..1220.331 rows=20 loops=1) | |
Sort Key: updated_at | |
Sort Method: top-N heapsort Memory: 51kB | |
-> Seq Scan on reservations (cost=0.00..158962.90 rows=5263 width=1053) (actual time=0.997..1216.519 rows=2266 loops=1) | |
Filter: (lower((last_name)::text) ~~ 'lin%'::text) | |
Total runtime: 1220.433 ms |
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
Indexes: | |
"reservations_pkey" PRIMARY KEY, btree (id) | |
"index_reservations_on_first_and_last_names" btree (lower(first_name::text), lower(last_name::text)) | |
== UpdateNameIndexToReservations: reverting ================================== | |
-- remove_index(:reservations, {:name=>"index_reservations_on_first_and_last_names"}) | |
rake aborted! | |
An error has occurred, this and all later migrations canceled: | |
Index name 'index_reservations_on_first_and_last_names' on table 'reservations' does not exist |