Skip to content

Instantly share code, notes, and snippets.

View grahamb's full-sized avatar
🇨🇦
As Canadian as possible under the circumstances

Graham Ballantyne grahamb

🇨🇦
As Canadian as possible under the circumstances
View GitHub Profile
@grahamb
grahamb / aqi.js
Last active September 18, 2020 20:34 — forked from jasonsnell/purpleaqijsnell.js
AQI Widget Code
// Displays Air Quality Index based on station data from
// aqicn.org
//
// Requires an API token: https://aqicn.org/data-platform/token/#/
//
// Configuration: configure the widget "Parameter" with a query string
// containing the station name and API token, e.g:
// station=Burnaby North Eton, British Comlumbia, Canada&token=12345
//
// based on widget code by Jason Snell <jsnell@sixcolors.com>
@grahamb
grahamb / files_controller.diff
Last active May 4, 2018 18:49 — forked from lukfugl/files_controller.diff
fix avatar upload for local storage
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index eeaa0d3..fe0e7d9 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -763,7 +763,9 @@ class FilesController < ApplicationController
@attachment.uploaded_data = params[:file] || params[:attachment] && params[:attachment][:uploaded_data]
if @attachment.save
# for consistency with the s3 upload client flow, we redirect to the success url here to finish up
- redirect_to api_v1_files_create_success_url(@attachment, :uuid => @attachment.uuid, :on_duplicate => params[:on_duplicate], :quota_exemption => params[:quota_exemption])
+ includes = Array(params[:success_include])
onPage(/\/courses\/\d+\/settings/, function() {
// do something
});
hasAnyRole('admin', function(hasRole) {
if (hasRole) {
// do something
} else {
// do something else
}
@grahamb
grahamb / dict.js
Created March 20, 2012 17:54 — forked from jnraine/dict.js
Y U SO VERBOSE JAVA?
{"foo": "bar", "baz": "quux"}