Skip to content

Instantly share code, notes, and snippets.

View jlcapps's full-sized avatar

Lee Capps jlcapps

View GitHub Profile
@jlcapps
jlcapps / occupation_course_credential.rb
Created June 15, 2012 16:33
Generate an occupation-course-credential report from CTE Resource Center API
#!/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
@jlcapps
jlcapps / ceop.rb
Created May 1, 2012 16:16
Ruby script to generate course cluster pathway occupation report
#!/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"]
# 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") }' \
@jlcapps
jlcapps / gist:231048
Created November 10, 2009 17:23 — forked from mguterl/gist:98172
# 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)