Skip to content

Instantly share code, notes, and snippets.

@andywarr
andywarr / strangerThings.ino
Last active October 24, 2016 01:25
Light 12mm LED Pixels
#include "Adafruit_WS2801.h"
#include "SPI.h" // Comment out this line if using Trinket or Gemma
#ifdef __AVR_ATtiny85__
#include <avr/power.h>
#endif
// 2 pins used for output.
uint8_t dataPin = 2; // Yellow wire on Adafruit Pixels
uint8_t clockPin = 3; // Green wire on Adafruit Pixels
@andywarr
andywarr / uber-dash.js
Last active May 30, 2016 21:13
Cancel an Uber
var https = require('https');
// For information about Uber http status codes see: https://developer.uber.com/docs/api-reference
const successfully_cancelled_uber_status_code = 204;
// For information about Uber tokens see: https://developer.uber.com/docs/authentication
const token = process.env.TOKEN;
function cancelUber(event, context) {
var headers = {
@andywarr
andywarr / uber-dash.js
Created May 30, 2016 20:00
Accept surge pricing
var https = require('https');
// For information about Uber http status codes see: https://developer.uber.com/docs/api-reference
const uber_surge_pricing_status_code = 409;
function requestUber(event, context, product_id, surge_confirmation_id) {
// MOAR CODE
// Uber has surge pricing
@andywarr
andywarr / uber-dash.js
Last active May 30, 2016 21:14
Request an Uber
var https = require('https');
// For information about Uber http status codes see: https://developer.uber.com/docs/api-reference
const successfully_requested_uber_status_code = 202;
const start_latitude = 37.7749; // Lat SF
const start_longitude = -122.4194; // Long SF
// For information about Uber tokens see: https://developer.uber.com/docs/authentication
const token = process.env.TOKEN;
@andywarr
andywarr / uber-dash.js
Created May 30, 2016 18:28
Detect AWS clickType
const uberx_id = 'a1111c8c-c720-46c3-8534-2fcdd730040d'; // UberX SF
const uberblack_id = 'd4abaae7-f4d6-4152-91cc-77523e8165a4'; // UberBlack SF
const single_click = 'SINGLE';
const double_click = 'DOUBLE';
const long_click = 'LONG';
function callUber(event, context) {
if (event.clickType === single_click) {
requestUber(event, context, uberx_id)