Skip to content

Instantly share code, notes, and snippets.

View Unkas82's full-sized avatar

Timko Unkas82

  • Ukraine
View GitHub Profile
<iframe width="1280" height="630" src="http://hockey.instatsport.com" frameborder="0" allowfullscreen></iframe>
<iframe width="1280" height="630" src="http://localhost:3000" frameborder="0" allowfullscreen></iframe>
pry(#<Api::V1::Geo::GeoController>)> ggg = db.lookup(@ip)
=> #<MaxMindDB::Result:0x00000009b39cd8
@raw=
{"city"=>
{"geoname_id"=>551487,
"names"=>
{"de"=>"Kasan", "en"=>"Kazan’", "es"=>"Kazán", "fr"=>"Kazan", "ja"=>"カザン", "pt-BR"=>"Cazã", "ru"=>"Казань", "zh-CN"=>"喀山"}},
"continent"=>
{"code"=>"EU",
"geoname_id"=>6255148,
<Event _id: 57e6882d6d632e50ab005245, event_id: 205272, action_code: 3040, type: "offside", title: "Offside", standard: nil, half: 2, seconds: 4126, pos_x: 86.0, pos_y: 60.0, pos_dest_x: 0.0, pos_dest_y: 0.0, url: "388939_2.mp4?start=1416&end=1436", start: 1416, end: 1436, offset_left: 0.0, fitness: nil, match_id: BSON::ObjectId('57e688046d632e50abf24b45'), player_id: 3895, team_id: 146, opponent_player_id: 0, opponent_team_id: nil>,
<Event _id: 596873d3165d87bb05018daa, event_id: 205272, action_code: 4040, type: "shot", title: "Shot blocked", standard: nil, half: 1, seconds: 1345, pos_x: 83.0, pos_y: 35.0, pos_dest_x: 96.0, pos_dest_y: 30.0, url: "583307_1.mp4?start=1335&end=1355", start: 1335, end: 1355, offset_left: 0.0, fitness: nil, match_id: BSON::ObjectId('5919ae52165d8771f374c0f2'), player_id: 120024, team_id: 1981, opponent_player_id: 63863, opponent_team_id: nil>,
<Event _id: 5975e099165d873c445b6a7a, event_id: 205272, action_code: 8010, type: "goal", title: "Goal", standard: nil, half: 2, seconds
"{\"players\":[{\"id\":238821,\"name\":\"Vinicius Rodolfo\",\"surname\":\"de Souza Oliveira\",\"nickname\":\"\",\"birth_date\":\"27.03.1995\",\"has_photo\":1,\"pref_foot\":null,\"weak_foot\":null,\"team_id\":390,\"national_team_id\":null,\"contract_expire_date\":null,\"team_name\":\"Botafogo RJ\",\"national_team_name\":null,\"citizenship\":[\"Brazil\"],\"positions\":[{\"title\":\"Forward\",\"percent\":80},{\"title\":\"Right midfielder\",\"percent\":11},{\"title\":\"Defensive midfielder\",\"percent\":7}],\"events\":[{\"pos_x\":57.3,\"pos_y\":44.0},{\"pos_x\":57.3,\"pos_y\":44.0},{\"pos_x\":86.7,\"pos_y\":63.6},{\"pos_x\":92.6,\"pos_y\":65.2},{\"pos_x\":77.7,\"pos_y\":8.5},{\"pos_x\":78.1,\"pos_y\":12.1},{\"pos_x\":87.1,\"pos_y\":44.0},{\"pos_x\":61.3,\"pos_y\":19.0},{\"pos_x\":61.3,\"pos_y\":19.0},{\"pos_x\":36.5,\"pos_y\":66.9},{\"pos_x\":44.9,\"pos_y\":58.4},{\"pos_x\":2.4,\"pos_y\":66.3},{\"pos_x\":1.1,\"pos_y\":64.5},{\"pos_x\":1.9,\"pos_y\":65.2},{\"pos_x\":9.0,\"pos_y\":55.7},{\"pos_x\":12.0,\"pos_y\":56
[5] pry(main)> wtf???!!!
Exception: NoMethodError: undefined method `to_sym' for nil:NilClass
Did you mean? to_s
--
0: /var/lib/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/sanitization.rb:59:in `block in expand_hash_conditions_for_aggregates'
1: /var/lib/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/sanitization.rb:58:in `each'
2: /var/lib/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/sanitization.rb:58:in `expand_hash_conditions_for_aggregates'
3: /var/lib/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/relation/query_methods.rb:957:in `build_where'
4: /var/lib/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/relation/query_methods.rb:584:in `where!'
5: /var/lib/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/relation/query_methods.rb:574:in `where'
{"f_match_event"=>"527967", "c_match_event_prop"=>"15", "value"=>"8336", "c_match_event_prop_value"=>nil, "f_player"=>"8336"}
{"f_match_event"=>"1894349", "c_match_event_prop"=>"15", "value"=>"4386", "c_match_event_prop_value"=>nil, "f_player"=>"4386"}
{"f_match_event"=>"4645987", "c_match_event_prop"=>"15", "value"=>"7466", "c_match_event_prop_value"=>nil, "f_player"=>"7466"}
{"f_match_event"=>"4645988", "c_match_event_prop"=>"15", "value"=>"7467", "c_match_event_prop_value"=>nil, "f_player"=>"7467"}
{"f_match_event"=>"1894349", "c_match_event_prop"=>"16", "value"=>"18.755980861244", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"1894349", "c_match_event_prop"=>"17", "value"=>"7.1791044776119", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"1894349", "c_match_event_prop"=>"26", "value"=>"62", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"3121445", "c_match_event_prop"=>"16", "value"=>"20.3875", "c_match_event_prop_value"=>nil, "f_player"=>nil
{"f_match_event"=>"1238233", "c_match_event_prop"=>"24", "value"=>"63", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"1238262", "c_match_event_prop"=>"24", "value"=>"63", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"9711581", "c_match_event_prop"=>"24", "value"=>"63", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"9706136", "c_match_event_prop"=>"24", "value"=>"63", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"9742693", "c_match_event_prop"=>"24", "value"=>"62", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"1894349", "c_match_event_prop"=>"26", "value"=>"62", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"2150517", "c_match_event_prop"=>"24", "value"=>"63", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"2153454", "c_match_event_prop"=>"24", "value"=>"63", "c_match_event_prop_value"=>nil, "f_player"=>nil}
{"f_match_event"=>"2156318", "c_match_event_prop
class StasProc3 < ActiveRecord::Migration
def up
connection.execute(%q{
CREATE OR REPLACE FUNCTION boxscore_ask_match_events (_p_match_id bigint, _p_half int DEFAULT 0::int) RETURNS TABLE(
f_match BIGINT
,id BIGINT
,half SMALLINT
,second real
,second_clear real