This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function disqusComments(cursor) { | |
var api_key = "YOUR_API_KEY"; | |
var forum = "YOUR_FORUM"; | |
var url = "https://disqus.com/api/3.0/forums/listThreads.json?api_key=" + api_key + "&forum=" + forum; //+ "&limit=100"; | |
if (cursor) { | |
url = url + "&cursor=" + cursor; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert'), | |
sinon = require('sinon'); | |
describe("Testing sinon useFakeTimers", function() { | |
it('sinon faking timer should work with small intervals', function() { | |
var clock = sinon.useFakeTimers(); | |
var spy = sinon.spy(); | |
setInterval(spy, 100); | |
assert(! spy.calledOnce); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
import codecs | |
import re | |
from bs4 import BeautifulSoup | |
import requests | |
reload(sys) | |
sys.setdefaultencoding("utf-8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Example jshint configuration file for Pebble development. | |
* | |
* Read: http://developer.getpebble.com/blog/2014/01/12/Using-JSHint-For-Pebble-Development/ | |
* And check out the full documentation at http://www.jshint.com/docs/options/ | |
*/ | |
{ | |
// Declares the existence of a global 'Pebble' object | |
"globals": { "Pebble" : true }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
simply.text({ | |
title: "Hello", | |
subtitle: "World", | |
body: "The real sense of life..." | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pebble.h> | |
Window *window; | |
TextLayer *text_layer; | |
TextLayer *date_layer; | |
InverterLayer *inverter_layer; | |
void handle_timechanges(struct tm *tick_time, TimeUnits units_changed) { | |
static char time_buffer[10]; | |
static char date_buffer[10]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pebble.h> | |
Window *window; | |
TextLayer *text_layer; | |
void handle_init(void) { | |
// Create a window and text layer | |
window = window_create(); | |
text_layer = text_layer_create(GRect(0, 0, 144, 154)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add those lines somewhere in your file */ | |
// Define what you want to do when the back button is pressed | |
void back_button_handler(ClickRecognizerRef recognizer, void *context) { | |
APP_LOG(APP_LOG_LEVEL_DEBUG, "back clicked"); | |
} | |
// We need to save a reference to the ClickConfigProvider originally set by the menu layer | |
ClickConfigProvider previous_ccp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var card = new Pebble.UI.Card({ title: "JSConf 2014", subtitle: "Scavenger Hunt", scrollable: true }); | |
card.show(); | |
var msg = "Contacting NSA to get your current position "; | |
var timer = setInterval(function() { | |
card.body(msg); | |
msg += "."; | |
}, 800); | |
function distanceBetweenCoordinates(pos1, pos2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Example provided by Pebble for the American Airlines - Gogo in flight - Wearable World Hackathon | |
* | |
* To use this project, please go to cloudpebble.net and create a new Pebble.js project. | |
* Copy and paste this gist in the app.js file. | |
* | |
* You will need to update the gogoStatusURL to point to a valid Gogo Inflight test server. | |
* An example JSON file is provided too. | |
*/ |
OlderNewer