This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This line might not be necessary, but try it if you see weird HTTP errors. | |
| jQuery.support.cors = true; | |
| var drowsyUrl = "http://localhost:9292"; | |
| /** List available databases **/ | |
| jQuery.ajax(drowsyUrl, { | |
| type: 'get', | |
| success: function (dbs) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var drowsyUrl = 'http://localhost:9292'; | |
| var db = 'fridge'; | |
| /** Set up a basic Model class for Drowsy that we will extend from **/ | |
| var DrowsyModel = Backbone.Model.extend({ | |
| idAttribute: '_id', | |
| // needed to deal with the way Drowsy returns ObjectIds | |
| parse: function(data) { | |
| data._id = data._id.$oid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| self.config.mongo | |
| // db: roadshow_config: | |
| // coll: runs: | |
| [ | |
| {'name': 'roadshow_monday_12323', 'locations': ['Poster 1', 'Poster 2', 'Poster 3'], '_id': '137c29183864e49dd9a00000'}, | |
| {'name': 'roadshow_tuesday_1232', 'locations': ['Poster 1', 'Poster 2'], '_id': '137c29183864e49dd9a00001'} | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| char cmd; | |
| #define CMD_ROCK 'r' | |
| #define CMD_PAPER 'p' | |
| #define CMD_SCISSORS 's' | |
| void setup() { | |
| Serial.begin(9600); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #define SERIAL_BAUDRATE 9600 | |
| #define MILLISECONDS_PER_FRAME 30 | |
| // the pins that control the brightness of RED, GREEN, and BLUE LEDs respectively | |
| #define R 9 | |
| #define G 10 | |
| #define B 11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #define SERIAL_BAUDRATE 9600 | |
| #define MILLISECONDS_PER_FRAME 30 | |
| // the pins that control the brightness of RED, GREEN, and BLUE LEDs respectively | |
| #define R 9 | |
| #define G 10 | |
| #define B 11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def initialize | |
| @students = {} | |
| end | |
| someone_joined_room do |stanza| | |
| stu = lookup_student(Util.extract_login(stanza.from), true) unless stanza.from == agent_jid_in_room | |
| if stu | |
| log "#{stu} joined #{config[:room]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // npm install git://github.com/zuk/Backbone.Drowsy.git | |
| // ... or just put the git URL in in package.json's dependencies | |
| var jQuery = require('jquery'); | |
| var _ = require('underscore'); | |
| var Backbone = require('backbone'); | |
| Backbone.$ = jQuery; | |
| var Drowsy = require('backbone.drowsy').Drowsy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| model.User = model.db.Document('users').extend({ | |
| setPhaseData: function(phaseKey, value) { | |
| var pd = this.get('phase_data'); | |
| pd[phaseKey] = fooBar; | |
| this.set('phase_data', pd); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CK.Model.init(config.drowsy.url, DATABASE).done(function () { | |
| CK.Model.initWakefulCollections(config.wakeful.url).done(function() { | |
| // do your stuff here | |
| }); | |
| }); |