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
# 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 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
# 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 { |
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
/* | |
cloud.js | |
a backend API for SNAP! | |
written by Jens Mönig | |
Copyright (C) 2014 by Jens Mönig |
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
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"}}' |
NewerOlder