Skip to content

Instantly share code, notes, and snippets.

View matthewtole's full-sized avatar

Matthew Tole matthewtole

View GitHub Profile
@matthewtole
matthewtole / ShakespeareanInsult.js
Created August 31, 2012 08:57
Shakespearean Insult Generator
// Shakespearean Insult Generator
//
// Generates a random Shakespearean insult given three word lists, taken
// from this web page: http://bit.ly/OBqi3K
var ShakespeareanInsult = function() {
var words1 = [ 'artless', 'bawdy', 'beslubbering', 'bootless', 'churlish',
'cockered', 'clouted', 'craven', 'currish', 'dankish', 'dissembling',
'droning', 'errant', 'fawning', 'fobbing', 'froward', 'frothy',
@matthewtole
matthewtole / gecko.js
Created September 23, 2012 21:21
Gecko, a collection of utility functions for building Chameleon Launcher widgets.
//
// This Gist has now been converted into it's own GitHub repository, to be found at https://github.com/matthewtole/chameleon-gecko
//
var gecko = (function () {
var me = {};
// Launch a browser with the specified URL.
me.openUrl = function(url) {
var
// Node modules
mongoose = require('mongoose')
, async = require('async')
, should = require('should')
, User = require(__dirname + '/../models/user')
/**
* Mocha Test
@matthewtole
matthewtole / simple-countdown.c
Last active December 19, 2015 10:49
Basic countdown app for the Pebble smartwatch.
#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"
#define MY_UUID { 0xD6, 0xEB, 0x90, 0xCA, 0x3F, 0x77, 0x43, 0xB7, 0xAD, 0x5A, 0x79, 0xDE, 0x29, 0xF8, 0x68, 0x7C }
PBL_APP_INFO(MY_UUID, "Simple Countdown", "Matthew Tole", 1, 0, DEFAULT_MENU_ICON, APP_INFO_STANDARD_APP);
Window window;
TextLayer text_layer;
@matthewtole
matthewtole / httpebble-simple.c
Last active December 19, 2015 18:59
An incredibly basic Pebble app that uses httpebble.
#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"
#include "http.h"
/* If compiling this for iOS, set ANDROID to be false. */
#define ANDROID true
#if ANDROID
#define MY_UUID { 0x91, 0x41, 0xB6, 0x28, 0xBC, 0x89, 0x49, 0x8E, 0xB1, 0x47, 0x10, 0x34, 0xBF, 0xBE, 0x12, 0x98 }
@matthewtole
matthewtole / http-uuid.c
Last active December 20, 2015 14:09
How to simply define your UUID for Pebble apps that use httpebble in a way that makes it easy to switch between Android and iOS versions.
// To make multi-version compilation simple, these type of config defines
// should be put in an external file, such as config.h
#define ANDROID false
// If this app is being compiled for Android, use a unique UUID that uses the
// httpebble prefix, otherwise you'll have to use the common UUID
// that is defined in http.h
#if ANDROID
#define MY_UUID { 0x91, 0x41, 0xB6, 0x28, 0xBC, 0x89, 0x49, 0x8E, 0xB1, 0x47, 0xD8, 0x14, 0xF0, 0x16, 0x02, 0x14 }
#else
@matthewtole
matthewtole / london-tube-status.php
Created August 8, 2013 15:28
The PHP API that powers my London Tube app for the Pebble Smartwatch. (http://matthewtole.com/pebble/#london-tube)
<?php
// Include my shared functions.
include_once($_SERVER['DOCUMENT_ROOT'] . '/utils.php');
// The URL of the Tube Status API.
$API_URL = 'http://api.tubeupdates.com/?method=get.status&format=json';
// Mapping between shortcode and line name.
$line_codes = array(
@matthewtole
matthewtole / make.sh
Created August 20, 2013 21:39
Pebble build script that uses libpebble to upload the build to the watch.
PEBBLE_ID=00:18:2F:CB:F6:D7;
LIBPEBBLE_PATH=/Users/matthewtole/pebble-dev/libpebble/p.py;
clear;
./waf clean build;
if [ $? == 0 ]
then
BUILD_FILE=$(ls build/*.pbw);
$LIBPEBBLE_PATH --pebble_id=$PEBBLE_ID --lightblue reinstall $BUILD_FILE;
fi
@matthewtole
matthewtole / make.sh
Created November 7, 2013 00:17
Sample build script for a Pebble SDK 2.0 app using Javascript.
jshint js/main.js || { exit 1; }
jshint pebble/appinfo.json || { exit 1; }
uglifyjs js/libs/firebase.js js/libs/superagent.js js/main.js -o pebble/src/js/pebble-js-app.js
cd pebble
pebble clean
pebble build || { exit 1; }
rm src/js/pebble-js-app.js || { exit 1; }
if [ "$1" = "install" ]; then
pebble install --logs
fi
@matthewtole
matthewtole / pebble-assist.h
Last active December 29, 2015 16:39
Pebble Assist - A collection of utility macros to make Pebble app development a bit simpler.
/***
* Pebble Assist
* Copyright (C) 2014 Matthew Tole
*
* Version 0.2.0
***/
/**
The MIT License (MIT)