Skip to content

Instantly share code, notes, and snippets.

View justinanderson's full-sized avatar

Justin Anderson justinanderson

View GitHub Profile
[
{
"id": "401011001",
"data": 1.21
},
{
"id": "401011002",
"data": 1.09
},
{
@justinanderson
justinanderson / contribution.md
Created February 9, 2022 17:17
Contribution Guidelines

Contribution Guidelines

  • Never commit directly to the master branch. Always work on a separate branch and merge into master via pull requests.

  • Try to avoid making merge commits. We use a rebasing workflow for this project's pull requests rather than merging. This includes keeping your local branches up to date with git pull --rebase rather than just git pull. Merge commits have a history of creating hard to diagnose bugs and make reviewing pull requests harder. Sometimes merge commit are unavoidable, but those situations should be rare.

  • Name your branches however you like, but please use meaningful names. Bad names include issue-42, bug-fixes, and justins-branch. Better names include map-layer-refactor, async-loading.

  • The same goes for commit messages. A commit message should describe what a commit does, preferably in the imperative mood. Bad messages look like:

@justinanderson
justinanderson / Create iOS Icons 2016 Sizes with 180.jsx
Created October 9, 2017 12:49 — forked from colus001/Create iOS Icons 2016 Sizes with 180.jsx
Photoshop Script to Create iOS Icons from a source image
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com

This is a shallow pass at designing DataHub's REST API. This covers how requests could work and doesn't yet consider responses. This is also just a mapping of DataHub's current functionality and doesn't consider new permissions models or other functionality.

The list below leaves out most parameters each endpoint would take, like the name of a new repo, to keep the list readable.

##Endpoints

GET    /user               # get current user's name
GET    /user/repos         # get current user's repos
GET    /repos              # get all repos visible to current user
@justinanderson
justinanderson / gist:7437205
Created November 12, 2013 19:30
Five articles from the MIT News Office formatted by the MIT Mobile API.
[
{
"id": "19420",
"source_url": "http://web.mit.edu/newsoffice/2013/hierarchical-capitalism-in-latin-america-1112.html",
"title": "A new path for growth",
"published_at": "2013-11-12T05:00:00-05:00",
"author": "Peter Dizikes, MIT News Office",
"dek": "In a new book, MIT political scientist Ben Ross Schneider sets out an agenda for growth with greater equality in Latin America.",
"featured": true,
"body": "The last three decades have represented a time of tectonic change in much of Latin America: Many authoritarian governments have been replaced by democracies, and free-market principles have supplanted many of the command economies of the past. Overall, these “shifts in the role of the state in Latin America have been epochal,” as MIT’s Ben Ross Schneider writes in a new book on the state of capitalism in the region. <br /><br />But the redevelopment of many of those states has not gone quite as politicians, policymakers, and economic theorists might have anticipated, as Sch
@justinanderson
justinanderson / bad-schema.json
Created September 6, 2013 16:09
This is an example of how JSON schema allows for deceptive schema. bad-schema.json looks like it requires an array to contain only strings, but in truth it only checks the first element of the array, so both bad.json and good.json validate against bad-schema.json. good-schema.json validates every element of the array, so good.json validates agai…
{
"type": "array",
"items": [
{
"type": "string"
}
]
}
@justinanderson
justinanderson / gist:6214444
Created August 12, 2013 19:47
Shallower structure for News images. The square images have predefined dimensions and the size of the aspect_140 one can be deduced from the dimensions of the full image, so we should be able to get away with this flattened image structure.
# Shallower
{
"images": [
{
"caption": "Cross-section view of the proposed silicon carbide cladding...",
"credits": "Image courtesy of Mujid Kazimi and Youho Lee",
"primary": true,
"width": 346,
"height": 368,
"url": "http://web.mit.edu/newsoffice/images/article_images/20130725220853-1.jpg",
@justinanderson
justinanderson / 00_Barker_Engineering_Library.json
Created May 31, 2013 18:57
Sample of how m.mit.edu represents MIT Libraries' locations and hours internally.
{
"name":"Barker Engineering Library",
"location":"10-500",
"phone":"6172530968",
"terms":[
{
"name":"Spring",
"dates":{
"start":"2013-02-05",
"end":"2013-05-24"
@justinanderson
justinanderson / shuttles.php
Created May 8, 2013 19:55
Example of how to get and display basic shuttle info from the MIT Mobile API.
<?php
$json = file_get_contents('http://m.mit.edu/api/?module=shuttles&command=routeInfo&id=tech');
$route = json_decode($json);
function hasID($stop)
{
return $stop->id=='tangwest';
}
@justinanderson
justinanderson / Sphinx.sublime-build
Last active December 14, 2015 08:59
Sublime build config for Sphinx on OS X.
{
"cmd": ["make", "html", "SPHINXBUILD=/usr/local/bin/sphinx-build"],
"file_regex": "(/.+):(\\d*): [A-Z]+:",
"working_dir": "${project_path:${folder}}"
}