Skip to content

Instantly share code, notes, and snippets.

View dylanvee's full-sized avatar

Dylan Vassallo dylanvee

View GitHub Profile
@dylanvee
dylanvee / gist:3419976
Created August 21, 2012 22:22
imagemagick crop square
# This snippet does everything I've ever wanted out of imagemagick.
# Equivalent to cropping to min(width, height) by min(width, height) and resizing to N x N.
# See http://www.imagemagick.org/Usage/thumbnails/#cut
# If you're writing this in bash or zsh, don't forget to escape the ^ with a backslash
convert -resize 256x256^ -extent 256x256 in.png out.png
@dylanvee
dylanvee / gist:3409403
Created August 20, 2012 23:54
db/ndb protocol buffer serialization
from google.appengine.ext import db, ndb
from google.appengine.datastore import entity_pb
def db_entity_to_protobuf(e):
return db.model_to_protobuf(e).Encode()
def protobuf_to_db_entity(pb):
# precondition: model class must be imported
return db.model_from_protobuf(entity_pb.EntityProto(pb))
var limit = 500;
$.get("/api/v1/dev/publish_list/" + limit + "?casing=camel").done(function(response) {
var statuses = _.chain(response)
.map(function(status) {
return {
timestamp: parseISO8601(status.startTime),
successful: status.success
}
})
Coach Reports
Exercise filter
/api/v1/exercise_topics
Student Progress
/api/v1/user/students/progressbystudent
Exercise Progress
/api/v1/user/students/progress/summary
Grid
/api/v1/user/students/progressreport
Activity
@dylanvee
dylanvee / gist:6677019
Last active December 23, 2015 18:39
Restored skills, by tutorial
This list is taken from my dev datastore so it might be slightly out
of date compared to the live site, but it's a good approximation.
Exponent properties
simplifying_expressions_with_exponents
simplifying_rational_expressions_1
Factoring quadratics in two variables
factoring_polynomials_with_two_variables
Factoring simple expressions
factoring_linear_binomials
{
"translated_short_display_name": "",
"assessment_items": [],
"relative_url": "/exercise/multiplying_expressions_0.5",
"guaranteed_file_name": "multiplying_expressions_0.5.html",
"file_name": "multiplying_expressions_0.5.html",
"covers": [],
"creation_date": "2012-03-02T03:30:14Z",
"uses_assessment_items": false,
"ka_url": "http://www.khanacademy.org/exercise/multiplying_expressions_0.5",
// promises is an array of jqXHRs or what have you
var deferreds = _.map(promises, function(promise) {
var deferred = $.Deferred();
promise.then(
function() {
deferred.resolve(true);
},
function() {
deferred.resolve(false);
}
khan
khanacaste
khanacre
khanal
khanalbumin
khanamed
khanarial
khanarium
khanation
khanational
var teaser = _.chain(data.stories)
.pluck("teaser")
.filter(function(t) { return !!t.length; })
.shuffle()
.first()
.value();
var teaser = _.chain(data.stories)
.pluck("teaser")
.filter(function(t) { return t && t.length })
.shuffle()
.first()
.value();