Skip to content

Instantly share code, notes, and snippets.

View cycomachead's full-sized avatar
status

Michael Ball cycomachead

status
View GitHub Profile
@cycomachead
cycomachead / lti_rails_engine_template.rb
Created March 17, 2016 22:19 — forked from coderberry/lti_rails_engine_template.rb
Rails template for creating LTI apps (as mountable rails engines)
# rails plugin new my_lti_app -T --mountable --dummy-path=spec/test_app -m URL_TO_THIS_RAW_GIST
def ask_wizard(question)
ask "\033[1m\033[30m\033[46m" + "prompt".rjust(10) + "\033[0m\033[36m" + " #{question}\033[0m"
end
def yes_wizard?(question)
answer = ask_wizard(question + " \033[33m(y/n)\033[0m")
case answer.downcase
when "yes", "y"
# This is weird logic to handle both an API request and an HTML request in 1 file. Some places we have 2 files which is even less dry.
# :majorsadface:
# In our sessions controller
# DELETE /api/users/logout
def destroy
respond_to do |format|
format.json {
@cycomachead
cycomachead / cloud.js
Created June 27, 2014 21:26
Snap Cloud Questions
/*
cloud.js
a backend API for SNAP!
written by Jens Mönig
Copyright (C) 2014 by Jens Mönig
import urllib2
from cookielib import CookieJar
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
# login to Piazza.
login_url = 'https://piazza.com/logic/api?method=user.login'
login_data = '{"method":"user.login","params":{"email":"alockwoo@andrew.cmu.edu","pass":"fakePassword"}}'