Skip to content

Instantly share code, notes, and snippets.

View battis's full-sized avatar

Seth Battis battis

View GitHub Profile
@battis
battis / course-card-image.js
Created August 3, 2016 15:08
Overlay Canvas course card with an arbitrary image
/* assume the course ID we're interested in is 3494 */
var id = 3494;
/* layer in CSS to load an arbitrary image */
$('.ic-DashboardCard__header_hero[data-reactid*="$' + id + '"]').css('background-image', 'url("https://skunkworks.stmarksschool.org/skunkworks.png")')
/*
* interesting next steps to consider include...
*
* - Scanning course file directories for a specifically named card image,
@battis
battis / login.svg
Last active August 22, 2016 03:58
Styling Canvas Mobile Login
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@battis
battis / README.md
Last active June 18, 2017 15:12
Reset the favorite courses for all users in a subaccount in Canvas

Install

  1. Download both files (composer.json and reset-favorites-core.php) into the same directory.
  2. Use composer to install dependencies:
cd path/to/that/directory
composer install
  1. Edit the PHP script to contain your actual $API_URL, $API_TOKEN and $ACCOUNT_ID
@battis
battis / canvasDataCli Config.sh
Created January 9, 2017 15:57
bashrc configuration to use canvasDataCli
# configure canvas-data-cli
export CD_API_KEY=keyvalue
export CD_API_SECRET=secretvalue
alias canvasDataCli="canvasDataCli -c path/to/config.js"
function unpackAllCanvasData {
for path in path/to/dataFiles/*
do
filter=$(basename $path)
if [ "$filter" != "schema.json" ]
then
@battis
battis / example.html
Created March 6, 2017 17:12
Accessing the Canvas APIs via JavaScript
<html>
<body>
<!-- load JQuery: copied and pasted from the JQuery CDN list -->
<script
src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script>
/*
* this allows us to make authenticated API requests to Canvas
@battis
battis / google-drive-sync.cfg
Created June 18, 2017 15:07
Is Google Drive Syncing? [Blink1]
RED=0
GREEN=255
@battis
battis / path_to_url.php
Last active July 30, 2017 17:58
Apache 2’s CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT Variables
$path = __FILE__;
$url = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on' ?
'http://' :
'https://'
) .
$_SERVER['SERVER_NAME'] .
$_SERVER['CONTEXT_PREFIX'] .
str_replace(
$_SERVER['CONTEXT_DOCUMENT_ROOT'],
'',
@battis
battis / open_remote_library.applescript
Last active July 31, 2017 00:35
Reliably Open iTunes Library on a Shared Volume
-- set server connection information here
property serverProtocol : "afp://"
property serverName : "your-server-name-here.local"
property volumeName : "shared-volume-name-here"
-- define the desired library location and save the current library location (http://stackoverflow.com/a/1693973/294171 explains exactly how to generate the appalling hexadecimal value for iTunesLibraryLocation below)
property iTunesLibraryLocation : ""
property libraryLocationPref : "com.apple.iTunes 'alis:1:iTunes Library Location'"
-- try to mount share from server
@battis
battis / link_to_cell.php
Created July 30, 2017 18:14
Linking to a Cell in a Google Spreadsheet
@battis
battis / google_reader_to_wordpress.php
Created July 30, 2017 18:16
Transmogrifying those Google Reader JSON dumps into something useful
/**********************************************************************
* Google Reader to Wordpress
*
* 2011-11-27
* Seth Battis ([email protected])
*
* This script takes the output of Google Reader's JSON export of
* shared items and converts it into an XML file that can be imported
* into a Wordpress blog as posts. All of the data in the original JSON
* file is preserved in the XML file, either by transfering it to