Skip to content

Instantly share code, notes, and snippets.

View dannypage's full-sized avatar
https://danny.page

Danny Page dannypage

https://danny.page
View GitHub Profile
@dannypage
dannypage / pregame.rb
Created December 30, 2013 19:30
Scraping the Pregame betting site for analysis of their results. As they use Divs for their tables, it took some trial and error to find the right fields with Nokogiri. This will create a CSV and covers the 2013 year, although it craps out quickly. Hmm. No records are shown, where I'm pretty sure there were before. Hacked up in a few hours, so t…
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'net/http'
require 'cgi'
require 'fileutils'
require "date"
begin
@dannypage
dannypage / bet.sh
Created May 30, 2013 13:13
Betting
#!/bin/bash
# Retreives and timestamps various XML feeds for later use
cd /Users/danielpage/Documents/BetCharts/
curl http://lines.bookmaker.eu/ > bookmaker-$(date +%Y-%m-%d-%H.%M.%S).xml
curl http://xmlfeed.intertops.com/XMLOddsFeed/IntertopsOdds.aspx > intertops-$(date +%Y-%m-%d-%H.%M.%S).xml
curl http://xml.betclick.com/odds_en.xml > betclick-$(date +%Y-%m-%d-%H.%M.%S).xml
@dannypage
dannypage / dot.dot
Created October 9, 2012 20:02
dotdotdot
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................<3
@dannypage
dannypage / CreateOptaEvents.rb
Created October 5, 2012 01:32
Migrations Needed for OptaRails
class CreateOptaEvents < ActiveRecord::Migration
def change
create_table :opta_events, :id => false do |t|
t.column :opta_game_id, :integer, :null => false
t.column :id, :integer, :primary => true
t.column :event_id, :integer
t.column :type_id, :integer
t.column :period_id, :integer
t.column :timeline, :integer
t.column :min, :integer
@dannypage
dannypage / f24.rb
Created October 4, 2012 16:08
Importing Opta F24 XML files - Will add F7 importing soon.
require 'nokogiri'
module Import
class F24
def self.get_xml_doc
print "File Name > "
fname = gets.strip
pn = "#{::Rails.root.to_s}/db/match_data/#{fname}.xml"
puts "Path and File Name: #{pn}"