This file contains 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 googleFormsService ($q, $rootScope, jQuery) { | |
angular.extend(this, { | |
/** | |
* Sends a response using Google Forms AJAX API (informal) | |
* @param {String} formKey The key of the form, e.g. 15QFO2VE44-9gAwcJeTPPWvxAX7v_1Ye9qmjdX2VzLBw | |
* @param {Object} values A list of key-value pairs to send as the form data, e.g. {'entry.6939333': 'John', 'entry.7399349': Due} | |
* @returns {*} Promise that will be resolved after the form request has been submitted | |
*/ | |
sendResponse(formKey, values) { | |
var deferred = $q.defer(); |
This file contains 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
#! /bin/sh | |
wget http://rogueamoeba.com/airfoil/download/AirfoilSpeakersLinux.all.deb | |
wget http://rogueamoeba.com/airfoil/download/AirfoilSpeakersRaspberryPi.tgz | |
sudo dpkg -i AirfoilSpeakersLinux.all.deb | |
sudo apt-get install -f | |
tar zxf AirfoilSpeakersRaspberryPi.tgz | |
sudo cp -p ./airfoilspeakers/lib/*ARM.so /usr/lib/airfoilspeakers | |
airfoilspeakers |
This file contains 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 <FastGPIO.h> | |
#define APA102_USE_FAST_GPIO | |
#include <APA102.h> | |
APA102<11, 12> ledStrip; | |
const uint16_t ledCount = 144; | |
rgb_color pixels[ledCount]; | |
void setup() { |
This file contains 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 ZLSound = require('com.salsarhythmsoftware.zlsound'); | |
function createUrlSound(url, localFilename) { | |
var sound = nil; | |
var autoPlay = false; | |
var request = Titanium.Network.createHTTPClient(); | |
var soundFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, localFilename); | |
if (soundFile.exists()) { | |
return ZLSound.createSample({media: soundFile.nativePath}); | |
} |
This file contains 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 startLoop(char) { | |
console.log('Connected !'); | |
setInterval(function() { | |
var t = ngbeacon.temperature(); | |
console.log(t); | |
var r = t > 22 ? 0xff : 0, | |
g = 0, | |
b = t > 22 ? 0 : 0xff; | |
char.writeValue(new Uint8Array([0x56, r, g, b, 0, 0xf0, 0xaa])); | |
}, 1000); |
This file contains 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 updateValues() { | |
var temperature = new Uint16Array([ngbeacon.humidity() * 100]); | |
var humidity = new Uint16Array([ngbeacon.humidity() * 100]); | |
NRF.updateServices({ | |
0x181A: { | |
0x2A6E: { value: temperature.buffer, notify: true }, | |
0x2A6F: { value: humidity.buffer, notify: true } | |
} | |
}); | |
} |
This file contains 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 bulbDevice = null; | |
var bulbChar = null; | |
function setColor(r, g, b) { | |
try { | |
bulbChar.writeValue(new Uint8Array([0x56, r, g, b, 0, 0xf0, 0xaa])); | |
} catch (e) { | |
} | |
} |
This file contains 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
const SNEEZE_THRESHOLD = 0.01; | |
const SNEEZE_TIMEOUT = 1000; /* ms */ | |
async function sneezeControl() { | |
const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); | |
const audioCtx = new AudioContext(); | |
const source = audioCtx.createMediaStreamSource(stream); | |
const analyser = audioCtx.createAnalyser(); | |
const dataArray = new Float32Array(analyser.fftSize); | |
let lastEvent = new Date().getTime(); |
This file contains 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
// Read the data through Web Bluetooth + visualize demo: https://plnkr.co/edit/96usNYVyKIo3s6pQB1Cu?p=preview | |
var mpu = require("MPU6050").connect(I2C1); | |
const BLE_UART_UUID = [0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,0xf3,0xa3,0xb5,0x01,0x00,0x40,0x6e]; | |
const EIR = { | |
CompleteListOf16BitServiceUuids: 0x3, | |
IncompleteListOf128BitServiceUuids: 0x6, | |
CompleteLocalName: 0x9, |
This file contains 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
// noprotect | |
async function sunsetTime(date) { | |
const resp = await fetch(`https://api.sunrise-sunset.org/json?lat=32.095&lng=34.847&formatted=0&date=${date}`) | |
const result = await resp.json(); | |
return new Date(result.results.sunset); | |
} | |
async function *getSunsets() { | |
for (let day = 1; day <= 31; day++) { |