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 scale( value, old_top, old_bottom, new_top, new_bottom ) | |
{ | |
// minTo + (maxTo - minTo) * ((value - minFrom) / (maxFrom - minFrom)) | |
return new_bottom + ( new_top - new_bottom ) * ( ( value - old_bottom ) / ( old_top - old_bottom ) ); | |
} |
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
// Libraries | |
var express = require( 'express' ); | |
var ibmbluemix = require( 'ibmbluemix' ) | |
var ibmdata = require( 'ibmdata' ); | |
var winston = require( 'winston' ); | |
// Constants | |
var LOG_PATH = '../logs/winston.log'; | |
// Bluemix |
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 router = require( 'express' ).Router(); | |
var Reading = { | |
// Get all readings | |
// Get latest reading | |
// Get readings within a page | |
getReadings: function( req, res ) { | |
var params = null; |
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
// Hardware access | |
var tessel = require( 'tessel' ); | |
// Sensor values | |
var humidity = null; | |
var temperature = null; | |
// Sensor | |
// Default address | |
var hih = tessel.port['B'].I2C( 0x27 ); |
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
import CoreBluetooth | |
import UIKit | |
class ViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralDelegate { | |
var manager:CBCentralManager! | |
var peripheral:CBPeripheral! | |
let BEAN_NAME = "Bean+" | |
let BEAN_SCRATCH_UUID = CBUUID(string: "a495ff21-c5b1-4b44-b512-1370f02d74de") |
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/bash | |
file="present.txt" | |
if [ -f "$file" ] | |
then | |
rm $file | |
defaults write com.apple.finder CreateDesktop true | |
killall Finder | |
else | |
echo "You got this." > $file |
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
{ | |
"api": "https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze", | |
"url": "http://_CONTENT_YOU_WANT_WATSON_TO_LOOK_AT_", | |
"username": "_YOUR_WATSON_API_USERNAME_", | |
"password": "_YOUR_WATSON_API_PASSWORD_", | |
"threshold": 0.70, | |
"limit": 20 | |
} |
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
<html> | |
<head> | |
<title>People</title> | |
<link href="/style/people.css" rel="stylesheet" type="text/css"> | |
</head> | |
<body> |
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 express = require( 'express' ); | |
var fs = require( 'fs' ); | |
var multer = require( 'multer' ); | |
var path = require( 'path' ); | |
var randomstring = require( 'randomstring' ); | |
// Router | |
var router = express.Router(); | |
// Upload storage options |
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 cfenv = require( 'cfenv' ); | |
var express = require( 'express' ); | |
var jsonfile = require( 'jsonfile' ); | |
var parser = require( 'body-parser' ); | |
var Particle = require( 'particle-api-js' ); | |
var request = require( 'request' ); | |
// External configuration | |
config = jsonfile.readFileSync( __dirname + '/config.json' ); |