Skip to content

Instantly share code, notes, and snippets.

View nathanborror's full-sized avatar

Nathan Borror nathanborror

View GitHub Profile
import UIKit
typealias Session = (NSDate, [Int])
let data = [
["created": NSDate(timeIntervalSince1970: 1422600001), "reps": 0],
["created": NSDate(timeIntervalSince1970: 1422600002), "reps": 1],
["created": NSDate(timeIntervalSince1970: 1422600003), "reps": 1],
["created": NSDate(timeIntervalSince1970: 1422700000), "reps": 0],
["created": NSDate(timeIntervalSince1970: 1422700000), "reps": 0],
enum HTTPRouter: URLRequestConvertible {
static let baseURL = "http://YOUR_HOST_URL"
case Upload(field: String, filename: String, mimeType: String, data: NSData)
var method: Alamofire.Method {
switch self {
case Upload:
return .POST
}
import (
"bytes"
"encoding/json"
)
// ToModel converts a string map to a given model
func ToModel(obj map[string]string, model interface{}) error {
j, _ := json.Marshal(obj)
d := json.NewDecoder(bytes.NewReader(j))
return d.Decode(model)

Intents you define and upload to Amazon

{
  "intents": [
    {
      "intent": "GetVolume",
      "slots": [
        {
          "name": "Room",
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>

iOS Over the Air App Distribution

  • Export your app using Xcode's Organizer, be sure and choose Save for Ad Hoc Deployment
  • Create a folder on Dropbox and add your app's .ipa file
  • Add app.plist to your folder with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@nathanborror
nathanborror / gist:77160
Created March 10, 2009 21:44
Widget service
/*
* Widget Maker
*
* <script type="text/javascript">
* var widget = {
* "id": "readernaut_widget",
* "width": 300,
* "height": 300
* };
* </script>
@nathanborror
nathanborror / gist:83774
Created March 23, 2009 21:00
Django template comparison filters
from django.template import Library
from django.template.defaultfilters import lower
register = Library()
@register.filter
def gt(value, arg):
"Returns a boolean of whether the value is greater than the argument"
return value > int(arg)
@nathanborror
nathanborror / gist:88735
Created April 1, 2009 15:18
oEmbed list additions

2.3.4.5 The books type

This type is used for representing books. The following parameters are defined:

title (required)

The title of the book

url (required)

The source URL of the book.

description (optional)

@nathanborror
nathanborror / gist:88850
Created April 1, 2009 19:20
Build your own JSON
object_list = []
for note in object_list:
obj = {
'id': note.pk,
'note': note.note,
'note.reader_book': {
'id': note.reader_book.id,
'title': note.reader_book.title,
'subtitle': note.reader_book.subtitle,
'authors': ", ".join(["%s" % a.get_full_name for a in note.reader_book.authors.all()]),