Skip to content

Instantly share code, notes, and snippets.

View BinaryMuse's full-sized avatar
🏳️‍🌈
Just gayin' up the place the best I can

Michelle Tilley BinaryMuse

🏳️‍🌈
Just gayin' up the place the best I can
View GitHub Profile
@BinaryMuse
BinaryMuse / .gems
Created October 29, 2010 22:17
xkcd2.heroku.com : Sinatra app to display xkcd comics so that the alt text can be seen
sinatra
haml
#!/usr/bin/env ruby
require 'pp'
REGEX = /(\d+)\s+(10\/[A-Z]{1}SP-\S+).*\s+([A-Z0-9]+)/i
YEAR = "2010"
TERM = "Spring"
teachers = {}
courses = []
@BinaryMuse
BinaryMuse / moodle.js
Created November 19, 2010 22:47
FireSheep handler for Moodle
register({
name: 'moodle.domain.com',
url: 'http://moodle.domain.com/',
icon: 'http://moodle.domain.com/theme/mytheme/favicon.ico',
domains: [ 'moodle.domain.com' ],
sessionCookieNames: [ 'MoodleSession', 'MoodleSessionTest' ],
identifyUser: function() {
var site = this.httpGet('http://moodle.domain.com/user/view.php');
this.userName = site.body.querySelector('div.logininfo a').text;
@BinaryMuse
BinaryMuse / template.rb
Created November 21, 2010 17:34
My Rails application template - under development! See comments for info.
# ============================================================================
# Info class
# ============================================================================
class ApplicationInfo < Rails::Generators::AppGenerator
attr_reader :notices, :errors, :options, :data
def initialize
@notices = [] # Array of notices to display to the user at the end
@errors = [] # Array of errors to display to the user at the end
@options = [] # Array of options selected throughout the template
# To just pull changes from Github, forcing Git to use your local changes for any conflicts:
git pull --strategy=ours origin master
# To completely update each of your Git repositories in one command (run this inside each repository):
git add . && git commit -m "Updating to current working version" && git pull --strategy=ours origin master && git push origin master
@BinaryMuse
BinaryMuse / rename-sshots.rb
Created January 3, 2011 19:11
Rename files inside the ~/Desktop/Screenshots folder to something slightly more sane.
#!/usr/bin/env ruby
# Rename files inside the ~/Desktop/Screenshots folder to something
# slightly more sane. Called via a folder action, but does not
# use any parameters from the action (the script scans for the files.)
#
# Example original filenames:
# ScreenCapture 2011-01-03 at 8.06.39 AM.png
# ScreenCapture 2011-01-03 at 8.06.39 AM (2).png
# Example destination filenames:
class ReleaseController
# when the user clicks subscribe
def subscribe
release = Release.find(params[:release_id])
email = params[:email_address]
parent_object = release.get_publisher_user_or_company
# parent_object is either User or a Company
parent_object.subscribe_to_email(email)
end
end
// if UG and creds 12 or greater FT, if UG and LT 12 then PT,
// if GR and 9 or greater then FT, and if GR and LT 9 then PT
//
// the fields are ${activeregcred} and ${acadlevel}
if(acadlevel == "UG") {
if(activeregcred >= 12) {
"FT"
} else {
"PT"
@BinaryMuse
BinaryMuse / 01_rvm_install.sh
Created January 28, 2011 21:11
DND - blog post
sudo apt-get install curl
sudo bash < <( curl -L http://bit.ly/rvm-install-system-wide )
sudo aptitude install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev