Skip to content

Instantly share code, notes, and snippets.

Working from home

Andrew Mager mager

Working from home
Block or report user

Report or block mager

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mager / medium-slackbot-4.js
Created Dec 29, 2015
Writing a Slackbot in 40 lines of code (Part 4)
View medium-slackbot-4.js
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
mager / medium-slackbot-3.js
Created Dec 28, 2015
Writing a Slackbot in 40 lines of code (Part 3)
View medium-slackbot-3.js'/post', function(req, res){
var parsed_url = url.format({
pathname: '',
query: {
access_token: process.env.GENIUS_ACCESS,
q: req.body.text
request(parsed_url, function (error, response, body) {
mager / medium-slackbot-2.js
Created Dec 28, 2015
Writing a Slackbot in 40 lines of code (Part 2)
View medium-slackbot-2.js
app.set('port', (process.env.PORT || 9001));
app.get('/', function(req, res){
res.send('It works!');
mager / medium-slackbot-1.js
Last active Dec 28, 2015
Writing a Slackbot in 40 lines of code (Part 1)
View medium-slackbot-1.js
var express = require('express');
var app = express();
var url = require('url');
var request = require('request');
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));
mager / index.html
Last active Nov 30, 2015
This is just a test
View index.html
html, body, #map_canvas {
height: 300px;
width: 300px;
<script type="text/javascript" src=""></script>
mager / get_delivery.json
Created Sep 2, 2015
Postmates API: Get the status of a delivery (/customers/:customer_id/deliveries/:delivery_id)
View get_delivery.json
"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",
View smartthings-smart-alarm.groovy
* 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 <> for more
* information.
* Version 2.4.3 (7/7/2015)
mager / sonos.groovy
Created Jun 23, 2015
Controlling Sonos from SmartThings
View sonos.groovy
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)
mager / sms-hue.php
Last active Aug 29, 2015
SmartThings SmartApp Example: SMS to Hue script
View sms-hue.php
$body = $_REQUEST['Body'];
$data = "{'value':'$body'}";
$options = array(
'http' => array(
'header' => "Authorization: Bearer <YOUR SMARTAPP TOKEN>\nContent-type: application/json",
'method' => 'PUT',
View twilio-to-smartapp.php
$url = '';
//$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(
You can’t perform that action at this time.