Skip to content

Instantly share code, notes, and snippets.

View mdobson's full-sized avatar
😺
Petting a cat

Matthew Dobson mdobson

😺
Petting a cat
View GitHub Profile
// Playground - noun: a place where people can play
import Cocoa
var str = "Test, playground"
//println(str)
let test = 1 + 1
class Shape {
@mdobson
mdobson / beacon.sh
Created June 3, 2014 23:54
ibeacon
#For beacon uuid E2A9E247-1F9C-47B8-9A6B-813AD63F3D58
export BLUETOOTH_DEVICE=hci0
export UUID="e2 a9 e2 47 1f 9c 47 b8 9a 6b 81 3a d6 3f 3d 58"
export MAJOR="00 01"
export MINOR="00 02"
export POWER="c8"
sudo tools/hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 $UUID $MAJOR $MINOR $POWER 00
@mdobson
mdobson / gist:1d6d104b0045545536a3
Created June 3, 2014 13:20
Apple Swift Hello World App
import UIKit
class ViewController: UIViewController {
@IBOutlet var button: UIButton
@IBOutlet var label: UILabel
@IBAction func buttonTapped(AnyObject) {
@mdobson
mdobson / accel1.json
Last active August 29, 2015 14:01
Models for devices
HTTP/1.1 200 OK
server: Cowboy
connection: keep-alive
date: Thu, 29 May 2014 20:16:07 GMT
content-length: 606
access-control-allow-origin: *
content-type: application/vnd.siren+json
via: 1.1 vegur
{
@mdobson
mdobson / accel.json
Last active August 29, 2015 14:01
Potential API Responses for Zetta
HTTP/1.1 200 OK
server: Cowboy
connection: keep-alive
date: Thu, 29 May 2014 20:16:07 GMT
content-length: 606
access-control-allow-origin: *
content-type: application/vnd.siren+json
via: 1.1 vegur
{
@mdobson
mdobson / curl.md
Last active August 29, 2015 14:00
Interview Stuff

Hi there!

Today we'll be building a simple app to make Async API calls and parse JSON. The ui should consist of a text box and button. We should enter a URL into the text box and retrieve the result.

Here is the curl statement for the endpoint that you'll be using today. Below you'll find the response from an http request against this heroku app. Just write a simple single view iOS app that makes a request and logs out the property of each JSON object.

curl -i http://ug-proxy.herokuapp.com/

@mdobson
mdobson / n.ino
Created April 25, 2014 17:56
Through hole neopixel
#include <Adafruit_NeoPixel.h>
#define PIN 6
Adafruit_NeoPixel led = Adafruit_NeoPixel(1, PIN, NEO_RGB + NEO_KHZ400);
void setup(){
led.begin();
led.show();
}
@mdobson
mdobson / gist:11254417
Created April 24, 2014 13:22
Accell pin layout
accelero.begin(4, 2, 6, 5, A0, A1, A2);
@mdobson
mdobson / h.ino
Last active August 29, 2015 14:00
read a humidity sensor
//From the bildr article http://bildr.org/2012/11/hih4030-arduino/
int HIH4030_Pin = A0; //analog pin 0
void setup(){
Serial.begin(9600);
}
void loop(){
@mdobson
mdobson / m.ino
Created April 21, 2014 20:28
How many motors could I possibly control?
/*
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control
For use with the Adafruit Motor Shield v2
----> http://www.adafruit.com/products/1438
*/
#include <Wire.h>