Skip to content

Instantly share code, notes, and snippets.

View acwio's full-sized avatar

Alex Williams acwio

View GitHub Profile
@acwio
acwio / data.js
Created July 22, 2015 18:33
Classification Data Example.
{
"completed":false,
"annotations":[
{
"task":"transcription",
"value":{
"0":{
"x":145.859375,
"y":281,
"letter":"Α",
{
"completed":false,
"annotations":[
{
"task":"transcription",
"value":{
"0":{
"x":145.859375,
"y":281,
"letter":"Α",
@acwio
acwio / classifcation.js
Created July 22, 2015 18:16
Classification model.
var Classification = Backbone.Model.extend({
url:"https://panoptes-staging.zooniverse.org/api/classifications",
// Specify default values for the model.
defaults: function(){
return {
'completed': false,
'annotations': [{
'task': 'transcription',
'value': {}
window.apiClient.api.type('projects').get(window.project_id).then(
function(project) {
console.log(project); /* retrieve all the pages for the project */
project[0].get('pages').then(
function(pages) {
/* iterate through each page
* and add content to the model */
for(var key in pages){
/* check for presence of 'url_key' */
if('url_key' in pages[key]) {
@acwio
acwio / gist:d4eae90385edb0cc52c2
Created July 13, 2015 20:06
API in the Model.
Project = Backbone.Model.extend({
urlRoot: "https://panoptes-staging.zooniverse.org/api/subject_sets?project_id="+window.project_id,
// Specify default values for the model.
defaults: function(){
return {
slug: 'default_slug',
display_name: '',
introduction: '',
description: '',
@acwio
acwio / example.js
Created July 2, 2015 17:40
Simple Panoptes API Consumption Example
sendAuthentication = function (xhr) {
xhr.setRequestHeader('Accept', "application/vnd.api+json; version=1");
};
SubjectModel = Backbone.Model.extend({
initialize:function(opts) {
console.log("init subject : "+opts.id);
}
});
Subjects = Backbone.Collection.extend({