Skip to content

Instantly share code, notes, and snippets.

View earltedly's full-sized avatar

Ted Bradley earltedly

View GitHub Profile
@earltedly
earltedly / Example.swift
Last active August 29, 2015 14:25
Swift extension to recreate a NSLayoutConstraint with a new multiplier and replace it
// In a UICollectionViewCell
@IBOutlet weak var leftStatConstraint: NSLayoutConstraint!
leftStatConstraint = leftStatConstraint.reapplyToView(self.contentView, multiplier: leftMultiplier)
@earltedly
earltedly / gist:2f3247d73a2ef8b0ebbb
Last active August 29, 2015 14:18
Pebble UUID in Swift
let pebble = PBPebbleCentral.defaultCentral()
pebble.delegate = self
var uuidBytes = Array<UInt8>(count:16, repeatedValue:0)
let uuid = NSUUID(UUIDString: "acde6706-633f-404d-b99a-1fc57842593a")
uuid?.getUUIDBytes(&uuidBytes)
pebble.appUUID = NSData(bytes: &uuidBytes, length: uuidBytes.count)
watch = pebble.lastConnectedWatch()
<snippet>
<content><![CDATA[APP_LOG(APP_LOG_LEVEL_DEBUG, "${1:message} %d %d %d %d", $2.origin.x, $2.origin.y, $2.size.w, $2.size.h);]]></content>
<tabTrigger>logrect</tabTrigger>
<scope>source.c</scope>
<description>Pebble rect log statement</description>
</snippet>
@earltedly
earltedly / tags.sh
Last active August 29, 2015 14:10
Generate tags
brew update
brew install ctags
cd ~/pebble-dev/PebbleSDK-current
rm -f tags
ctags --c-kinds=+p -R --exclude=arm-cs-tools/arm-none-eabi/include/c++ \
arm-cs-tools/arm-none-eabi/include Pebble/include
cd -
ls ~/pebble-dev/PebbleSDK-current/tags
@earltedly
earltedly / .bash_profile
Created April 15, 2014 11:37
pebble run and log bash function
function pebblerun()
{
pebble install --phone $1
sleep 2
pebble logs --phone $1
}
@earltedly
earltedly / pebblelog.sublime-snippet
Created April 11, 2014 15:12
Pebble log statement snippet
<snippet>
<content><![CDATA[APP_LOG(APP_LOG_LEVEL_DEBUG, "${1:message}");]]></content>
<tabTrigger>log</tabTrigger>
<scope>source.c</scope>
<description>Pebble log statement</description>
</snippet>
{
"working_dir": "${project_path:${file_path}/..}",
"shell_cmd": "pebble build",
"file_regex": "^..\/(.+?):([0-9]+?):([0-9]+?): (.*)$"
}
@earltedly
earltedly / CTags.sublime-settings
Last active August 29, 2015 13:58
Sublime CTags settings for Pebble
{
"autocomplete": true,
"command": "/usr/local/bin/ctags",
"opts" : ["--exclude=build"],
// MAKE SURE TO REPLACE <yourusernamehere> with your username
"extra_tag_files": [".gemtags", "tags","/Users/<yourusernamehere>/pebble-dev/PebbleSDK-current/tags"],
}
@earltedly
earltedly / garmin_tag.rb
Created July 9, 2012 08:37
Jekyll Garmin activity references
# Title: Simple Garmin tag for Jekyll
# Author: Ted Bradley http://monkeysandtea.com
# Description: easily embed a Garmin iframe using only the activity id. Has to be set to public though.
#
# Syntax {% garmin activityId [width height] %}
#
# Example:
# {% garmin 123456 465 548 %}
#
# Output: