Skip to content

Instantly share code, notes, and snippets.

View johnnysparks's full-sized avatar

Johnny Sparks johnnysparks

View GitHub Profile
@johnnysparks
johnnysparks / UserSeeder.rb
Last active December 16, 2015 08:39
Steam Profile Name Scrapper
require 'open-uri'
require 'nokogiri'
require 'cgi'
# UserSeeder class has one important method -> get_user
# all forum and discussion pagination should be automagic
class UserSeeder
def initialize
@forum = -1 # only access to new forum page increments before fetching, staring at -1
@user_buffer = [] # user buffer holds the list of profile names
@johnnysparks
johnnysparks / johnnyfuchs.txt
Created April 13, 2013 04:22
Sad steam game list.
1 208480 480.5 Assassins Creed III
2 72850 279.7 The Elder Scrolls V: Skyrim
3 205100 273.1 Dishonored
4 35140 208.2 Batman: Arkham Asylum GOTY Edition
5 217790 71.5 Dogfight 1942
6 8930 36.7 Sid Meiers Civilization V
7 24780 36.6 SimCity 4 Deluxe
8 620 17.2 Portal 2
9 400 15.3 Portal
10 41500 8.8 Torchlight
@johnnysparks
johnnysparks / UserGameScrape.rb
Created April 13, 2013 03:56
One-off script for grabbing a users steam games and hours played.
require 'open-uri'
require 'nokogiri'
require 'cgi'
require 'json'
# UserGameScrape
#
# Usage:
# ugs = UserGameScrape.new
# games_tsv_string = ugs.games( steam_game_name )
@johnnysparks
johnnysparks / SteamGameScrape.rb
Last active December 15, 2015 22:29
Ruby class to collect list of steam game names.
require 'open-uri'
require 'nokogiri'
require 'cgi'
class SteamGameStrape
def initialize
@page = 1
@url = "http://store.steampowered.com/search/results"
@user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22"
@row = 0
@johnnysparks
johnnysparks / search_row.html
Last active December 15, 2015 22:19
Steam Search Results Item
<a class="search_result_row even" href="http://store.steampowered.com/app/211160/?snr=1_7_7_230_150_24">
<div class="col search_price"> &#36;14.99 </div>
<div class="col search_type">
<img src="http://cdn2.store.steampowered.com/public/images/ico/ico_type_app.gif">
</div>
<div class="col search_metascore"></div>
<div class="col search_released"> Oct 17, 2012 </div>
<div class="col search_capsule">
<img src="http://cdn2.steampowered.com/v/gfx/apps/211160/capsule_sm_120.jpg?t=1350669009" alt="Buy Viking: Battle for Asgard" width="120" height="45">
</div>
@johnnysparks
johnnysparks / mongohq_ajax.html
Created May 14, 2012 03:00
Quick MongoHQ ajax demo
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
// post demo
$.ajax({
dataType: "json",
type: "post",
@johnnysparks
johnnysparks / templMethods.js
Created May 10, 2012 15:29
Koi namespace / extend
/**
* Checkout bobbitt's base koi examples here:
* https://github.com/ericb/Koi/blob/master/examples.js
*/
// use koi namespace to define a new object level ( this is basically if !tmplMethods, tmplMethods = {} )
Koi.namespace('tmplMethods');
// if there are methods used across a section of the application, you could nest deeper ( common ajax calls or something )