Skip to content

Instantly share code, notes, and snippets.

View tylerpearson's full-sized avatar

Tyler Pearson tylerpearson

View GitHub Profile
@tylerpearson
tylerpearson / gist:cb5c8a884ddd537d8300
Created December 30, 2015 00:31
Ruby scraper for bills introduced in the West Virginia legislature
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'json'
YEAR = ARGV.first
if YEAR.nil?
puts "Please pass a year to scrape"
mysql_upgrade -u root -p --force
{
"auto_complete": true,
"bold_folder_labels": true,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/Predawn/predawn.tmTheme",
"copy_with_empty_selection": true,
"drag_text": false,
"draw_minimap_border": true,
pio deploy -- --driver-memory 4g --executor-memory 4g
@tylerpearson
tylerpearson / gist:547b6c49d32e369b3eb7
Created October 30, 2015 05:41
Run prediction.io with Java MySQL driver
pio train -- --driver-class-path ~/Downloads/mysql-connector-java-5.1.37/mysql-connector-java-5.1.37-bin.jar
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'json'
page = Nokogiri::HTML(open('http://www.alec.org/model-legislation/'))
FILENAME = ARGV.first || "alec-model-bills.json"
bill_urls = []
bills = []
@tylerpearson
tylerpearson / simhash_query.sql
Last active September 29, 2015 15:57
sample SQL query to find related posts using a simhash
SELECT id, title, (LENGTH(CONV(fp ^ ?, 10, 2)) - LENGTH(REPLACE(CONV(fp ^ ?, 10, 2), '1', ''))) / LENGTH('1') AS comparison
FROM posts
ORDER BY comparison ASC
*Relating to welfare system integrity* is similar to *Welfare System Integrity Act* -- score of *7*
*Creating Asbestos Bankruptcy Trust Claims Transparency Act and Asbestos and Silica Claims Priorities Act* is similar to *Asbestos and Silica Claims Priorities Act* -- score of *10*
*Relating to employment and privacy protection* is similar to *Employee Online Privacy Act* -- score of *14*
*Creating Public Charter Schools Act of 2015* is similar to *Public Charter School Funding and Facilities Model Legislation* -- score of *14*
*West Virginia Public Charter Schools Act of 2015* is similar to *Public Charter School Funding and Facilities Model Legislation* -- score of *15*
*Aged, Blind, Disabled and Long Term Services and Support Managed Care Act* is similar to *Medicaid Managed Long-Term Services and Supports Act* -- score of *16*
*Relating to sales tax increment financing* is similar to *Tax Expenditure Transparency Act* -- score of *16*
*Relating to uncompensated care* is similar to *Uncompensated Care Liabi
*Limiting liability of participants in certain water pollution abatement projects* is similar to *The Environmental Good Samaritan Act* -- score of *10*
*Revising Child Welfare Act* is similar to *Juvenile Justice Act* -- score of *21*
*Relating to student-school nurse staffing ratio* is similar to *Indiana Education Reform Package* -- score of *22*
*Expiring funds from State Fund, General Revenue, and making supplementary appropriations to MAPS* is similar to *Pension Funding and Fairness Act* -- score of *22*
*Creating Intermediate Court of Appeals* is similar to *Model Act On Private Enforcement Of Consumer Protection Statutes* -- score of *23*
*Establishing comparative fault standard* is similar to *Joint and Several Liability Act* -- score of *23*
*Relating to education reform* is similar to *The Next Generation Charter Schools Act* -- score of *24*
*Supplementing, amending, decreasing and increasing appropriations from State Road Fund to DOH* is similar to *Tax and Expenditure Limitation Act* -- score o
*Limiting liability of landowners, operators and contractors in water pollution abatement projects* is similar to *The Environmental Good Samaritan Act* -- score of *10*
*Providing more flexibility to county school boards in managing schools* is similar to *Parent Trigger Act* -- score of *13*
*Creating a healthcare compact* is similar to *Health Care Compact Act* -- score of *16*
*Creating a system for the bifurcation for trial of claims for compensatory and exemplary damages* is similar to *Punitive Damages Standards Act* -- score of *19*
*Allowing counties and municipalities to levy a sales tax on food and beverages sold at restaurants* is similar to *Use Tax Elimination Act* -- score of *22*
*Relating to employment and privacy protection* is similar to *Employee Online Privacy Act* -- score of *23*
*Granting a labor organization a privilege from being compelled to disclose any communication or information the labor organization or agent received or acquired in confidence from an employee* is similar to *E