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
app.listen(app.get('port'), function() { | |
console.log('Node app is running on port', app.get('port')); | |
}); |
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
app.post('/post', function(req, res){ | |
var parsed_url = url.format({ | |
pathname: 'https://api.genius.com/search', | |
query: { | |
access_token: process.env.GENIUS_ACCESS, | |
q: req.body.text | |
} | |
}); | |
request(parsed_url, function (error, response, 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
app.set('port', (process.env.PORT || 9001)); | |
app.get('/', function(req, res){ | |
res.send('It works!'); | |
}); |
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 app = express(); | |
var url = require('url'); | |
var request = require('request'); | |
var bodyParser = require('body-parser'); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: 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
<html> | |
<head> | |
<style> | |
html, body, #map_canvas { | |
height: 300px; | |
width: 300px; | |
} | |
</style> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script> |
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
{ | |
"status": "dropoff", | |
"dropoff": { | |
"phone_number": "646-234-2271", | |
"name": "Mager's House", | |
"notes": "", | |
"detailed_address": { | |
"city": "New York City", | |
"country": "US", | |
"street_address_1": "498 Central Park N", |
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
/** | |
* Smart Alarm is a multi-zone virtual alarm panel, featuring customizable | |
* security zones. Setting of an alarm can activate sirens, turn on light | |
* switches, push notification and text message. Alarm is armed and disarmed | |
* simply by setting SmartThings location 'mode'. | |
* | |
* Please visit <http://statusbits.github.io/smartalarm/> for more | |
* information. | |
* | |
* Version 2.4.3 (7/7/2015) |
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
preferences { | |
section("Title") { | |
input "player", "capability.musicPlayer", title: "music player", required: true, multiple: false | |
input "frontDoor", "capability.contactSensor", title: "front door", required: true, multiple: false | |
} | |
} | |
def installed() { | |
subscribe(frontDoor, "contact", myHandler) | |
} |
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
<?php | |
$url = '<YOUR SMARTAPP ENDPOINT>'; | |
$body = $_REQUEST['Body']; | |
$data = "{'value':'$body'}"; | |
$options = array( | |
'http' => array( | |
'header' => "Authorization: Bearer <YOUR SMARTAPP TOKEN>\nContent-type: application/json", | |
'method' => 'PUT', |
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
<?php | |
$url = 'https://graph.api.smartthings.com/api/smartapps/installations/dc20d3c1-7573-4fe2-9e13-ac095c4eb20e/hue'; | |
//$data = array('text' => 'color=orange'); | |
$body = $_REQUEST['Body']; | |
$data = "{'value':'$body'}"; | |
// use key 'http' even if you send the request to https://... | |
$options = array( | |
'http' => array( |