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
/* | |
* Plays the melody "Matoyas cavern" from Final Fantasy I with Arduino. | |
* | |
* Connect two pins to a speaker with ~100ohm resistors and listen. | |
*/ | |
#include <Tone.h> | |
Tone tone1, tone2; | |
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
/* Discrete Fréchet Distance | |
* By Andreas Argelius http://argeli.us/ | |
* | |
* Implementation of Discrete Frechet Distance in Javascript. | |
* | |
* The paths are defined as [[x0, y0], [x1, y1], ...] | |
* | |
*/ | |
(function() { |
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
angular.module('app', []) | |
.factory('$geolocation', function($q) { | |
return { | |
get: function() { | |
var deferred = $q.defer(); | |
navigator.geolocation.getCurrentPosition( | |
function(result) { | |
deferred.resolve(result); |
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
// services.js | |
(function() { | |
'use strict'; | |
angular.module('app') | |
// Get current location. | |
.factory('$geolocation', function($q) { | |
this.get = function() { |
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
// controllers.js | |
(function() { | |
'use strict'; | |
angular.module('app') | |
.controller('WeatherController', function($scope, $window, $geolocation, $weather, $interval) { | |
// Create popover when Onsen UI is loaded. |
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
<html ng-app="app"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="format-detection" content="telephone=no" /> | |
<meta name="msapplication-tap-highlight" content="no" /> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> | |
<link rel="stylesheet" type="text/css" href="css/onsen-css-components.css" /> | |
<link rel="stylesheet" type="text/css" href="css/onsenui.css" /> | |
<title>Onsen Weather</title> | |
<style> |
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
// app.js | |
(function() { | |
'use strict'; | |
angular.module('app', ['onsen']) | |
// OpenWeatherMap API returns temperature in degrees Kelvin. | |
.filter('kelvinToCelsius', function() { | |
return function(kelvin) { |
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
<script src="https://cdn.firebase.com/js/client/2.1.1/firebase.js"></script> | |
<script> | |
var fb = new Firebase('https://hacker-news.firebaseio.com/v0'); | |
</script> |
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
// Create a reference to https://hacker-news.firebaseio.com/v0/topstories | |
var topStoriesRef = fb.child('topstories'); |
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
topStoriesRef.on('value', function(snapshot) { | |
console.log(snapshot.val()); | |
}); |
OlderNewer