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
| /* changes the light or reports its status */ | |
| String changeLight(int val) { | |
| /* turn light on */ | |
| if(val== 1) { | |
| digitalWrite(pin, HIGH); | |
| lightStatus = "on"; | |
| /* turn light off */ | |
| } else if(val==0) { | |
| digitalWrite(pin, LOW); | |
| lightStatus = "off"; |
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
| void printWebResponse(WiFiClient client, String lightStatus) { | |
| Serial.println(); | |
| // so the http request has ended and we can send a reply | |
| // send a standard http response header | |
| client.println("HTTP/1.1 200 OK"); | |
| client.println("Access-Control-Allow-Origin: *"); | |
| client.println("Content-Type: text/html"); | |
| client.println(); | |
| client.println("{\"status\":\""+lightStatus+"\"}"); | |
| } |
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
| window.onload = function() { | |
| /* ip address of arduino */ | |
| var URL = "00.0.0.0"; | |
| var lightDiv = $('#lightbulbContainer'); | |
| /* find out current state of the light and adjust the UI accordingly */ | |
| $.ajax({ | |
| type: "GET", | |
| url: URL+"/led=-1" |
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
Show hidden characters
| [ | |
| { | |
| "class": "sidebar_container", | |
| // right border | |
| "layer0.tint": [84,84,84], | |
| "layer0.opacity": 1.0, | |
| "layer0.draw_center": false, | |
| "layer0.inner_margin": [0, 0, 1, 0], | |
| "content_margin": [0, 0, 1, 0] | |
| }, |
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
| toArray = [] | |
| $smsToken = '' | |
| $phoneNumber = '' | |
| get '/text' do | |
| toArray.each do |element| | |
| callSmsScript("Hi", element) | |
| sleep(5) | |
| end |
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
| post '/voice.json' do | |
| t = Tropo::Generator.new | |
| t.ask :name => 'digit', | |
| :timeout => 60, | |
| :say => {:value => "Hello! What year were you born?"}, | |
| :choices => {:value => "[4 DIGITS]"} | |
| t.on :event => 'continue', :next => '/continue.json' |
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
| <video id="videoInput" width="640px" height="480px" autoplay></video> | |
| <img id="img" src="" style="display: none" /> | |
| <canvas width="440px" height="580px" style="display:none;"></canvas> |
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
| window.onload = function() { | |
| var video = document.querySelector('video'); | |
| var canvas = document.querySelector('canvas'); | |
| var ctx = canvas.getContext('2d'); | |
| var localMediaStream = null; | |
| window.URL = window.URL || window.webkitURL; | |
| navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || | |
| navigator.mozGetUserMedia || navigator.msGetUserMedia; |
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
| function snapshot() { | |
| if (localMediaStream) { | |
| var img = document.querySelector('img'); | |
| /* draws the image to the canvas */ | |
| ctx.drawImage(video, 0, 0); | |
| /* loads the img to the hidden img tag */ | |
| img.src = canvas.toDataURL('image/webp'); | |
| img.style.display= "block"; | |
| } | |
| } |
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
| load 'vpim-13.11.11/lib/vpim/vcard.rb' | |
| #read file as string | |
| address_book = File.open('contacts.vcf') | |
| contents = address_book.read | |
| #load contacts | |
| original = Vpim::Vcard.decode(contents) | |
| #create new file |