This file contains hidden or 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 | |
# include all the software libraries we'll use, first the standard libraries | |
# (i.e., these come with ruby 1.9) | |
require 'csv' # for generating CSV output | |
require 'json' # for parsing javascript objects from the API | |
require 'net/http' # for talking to the server | |
# this is a 3rd party library, installed using ruby gems: | |
# gem install addressable |
This file contains hidden or 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 | |
require 'csv' | |
require 'json' | |
require 'net/http' | |
puts CSV.generate_line(%w{ Title Code Edition Cluster Pathway Occupation }) | |
courses = JSON.parse( | |
Net::HTTP.get('api.cteresource.org', '/courses/', 80) | |
)["courses"] |
This file contains hidden or 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
# some helpful ruby functions for ~/.bashrc | |
# cd to the load path of a ruby module. E.g: | |
# $ cdr net/http | |
# $ pwd | |
# /path/to/lib/ruby/1.8 | |
# | |
cdr () { | |
cd $(ruby -e 'require "#{ARGV.first}"; | |
puts $LOAD_PATH.detect { |path| File.exist?("#{path}/#{ARGV.first}.rb") }' \ |
This file contains hidden or 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
# credits | |
# http://github.com/hartcode/serverjuice/ | |
# http://blog.fiveruns.com/2008/3/3/compiling-ruby-rubygems-and-rails-on-ubuntu | |
# http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html | |
# upgrade packages | |
apt-get update | |
apt-get upgrade | |
# install reasonably easy-to-use text editor (skip this if you can wield something greater) |