This file contains 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 'csv' | |
require 'pry' | |
file = 'lackp_starting_rosters.csv' | |
# Create an empty teams hash | |
teams = {} | |
# Open up the CSV and save it to the variable csv | |
csv = CSV.open(file, headers: true) |
This file contains 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 "sinatra" | |
require "csv" | |
require "shotgun" | |
before do | |
@players = [] | |
CSV.foreach('lackp_starting_rosters.csv', headers: true, header_converters: :symbol) do |row| | |
@players << { | |
name: row[0] + ' ' + row[1], position: row[2], team_name: row[3] | |
} |
This file contains 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
#!/usr/bin/env ruby | |
# | |
# file_organizer.rb | |
# (http://gist.github.com/16180) | |
# | |
# By M@ McCray -- www.mattmccray.com (matt at elucidata dot net) | |
# | |
# Usage: | |
# | |
# organize_files_within( target_folder ) |
This file contains 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
# convert PDF to jpg | |
# use sips if available, ImageMagick(`convert`) with ghostscript otherwise | |
# convert -quality 90 /Users/trek/Desktop/postcard.pdf /Users/trek/Desktop/postcard.png | |
# | |
# postful image should be | |
# | |
# 6.25"x4.5" (450x324) | |
# 0.125" trim | |
# 300dpi | |
# 1875x1350 |
This file contains 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 'rubygems' | |
require 'feedzirra' | |
# gem install feedzirra | |
url = "http://sunlightlabs.com/blog/feeds/tag/datacatalog/" | |
feed = Feedzirra::Feed.fetch_and_parse(url) | |
puts feed.title | |
puts feed.url | |
puts feed.feed_url |
This file contains 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
# http://code.google.com/apis/visualization/documentation/gallery/piechart.html#Example | |
def pie_chart | |
@chart = GoogleVisualr::PieChart.new | |
@chart.add_column('string', 'Task') | |
@chart.add_column('number', 'Hours per Day') | |
@chart.add_rows(5) | |
@chart.set_value(0, 0, 'Work' ) | |
@chart.set_value(0, 1, 11 ) | |
@chart.set_value(1, 0, 'Eat' ) |
This file contains 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
# Simple bootloader for Rails plugins in Sinatra | |
# This checkes the +plugin_folder+ for plugin-like bundles. For each folder it finds it will do: | |
# If the +lib+ folder exists: add it to our load path | |
# If a +init.rb+ file exists: require it | |
# Not very robust but it is lightweight for loading simple rails plugins | |
class PluginLoader | |
attr_reader :plugin_folder | |
def initialize(plugin_folder) | |
@plugin_folder = plugin_folder |
This file contains 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
module Feedzirra | |
module Parser | |
class FlickrEntry | |
include SAXMachine | |
include FeedEntryUtilities | |
element :guid, :as => :id | |
element :link, :as => :url |
This file contains 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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
$KCODE = 'UTF8' | |
require 'rubygems' | |
require 'google-search' | |
query = ARGV[0] || "paris hilton" | |
HTML = File.dirname(__FILE__) + '/face.html' | |
open(HTML, 'w') do |file| |
OlderNewer