This file contains hidden or 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 getCover(title) { | |
return $http.get(itunesSearchUrl + title).then(function(response) { | |
var item = response.data.results[0]; | |
if (!item || !item.artworkUrl100) { | |
return null; | |
} | |
return item.artworkUrl100.replace(resolutionRegex, '500x500'); | |
}); | |
} |
This file contains hidden or 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 getStreamInfo() { | |
return $http.get(metadataUrl).then(function(response) { | |
var title = parseShoutcastResponse(response.data); | |
if (!title) { | |
return {}; | |
} | |
return getCover(title).then(function(coverUrl) { | |
return { | |
title: title, | |
coverUrl: coverUrl |
This file contains hidden or 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('starter.services', []) | |
.factory('Chats', function() { | |
// Might use a resource here that returns a JSON array | |
// Some fake testing data | |
var chats = [{ | |
id: 0, | |
name: 'Ben Sparrow', | |
lastText: 'You on your way?', |
This file contains hidden or 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 pause() { | |
vm.info = null; | |
$interval.cancel(timer); | |
if (!stream) { | |
return; | |
} | |
stream.stop(); | |
} |
This file contains hidden or 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 getStreamInfo() { | |
streamService.getStreamInfo().then(function(info) { | |
vm.info = info; | |
}, function() { | |
vm.info = null; | |
}); | |
} |
This file contains hidden or 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('starter.controllers', []) | |
.controller('DashCtrl', function($scope) {}) | |
.controller('ChatsCtrl', function($scope, Chats) { | |
// With the new view caching in Ionic, Controllers are only called | |
// when they are recreated or on app start, instead of every page change. | |
// To listen for when this page is active (for example, to refresh data), | |
// listen for the $ionicView.enter event: | |
// |
This file contains hidden or 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
<ion-view view-title="{{vm.info.title || 'Audio Stream'}}"> | |
<ion-content class="center" style=" | |
background: url({{vm.info.coverUrl || 'images/ionic.png'}}) center center; | |
background-size: cover;"> | |
<a class="button button-icon icon play-button-icon {{ vm.isPlaying ? 'ion-ios-pause' : 'ion-ios-play' }}" | |
ng-click="vm.togglePlay()"></a> | |
</ion-content> | |
</ion-view> |
This file contains hidden or 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 getNetworkStatus() { | |
// On Android and when only the 3G interface is on | |
// the return connection type is `unknown` even the device is online. | |
// To work around this we will assume that only Connection.NONE | |
// is declaring an offline device. Which is returned when data are | |
// disabled. | |
var isPluginAvailable = !!navigator.connection; |
This file contains hidden or 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
#!/bin/bash | |
# Copy the repair-hooks.sh files into the hooks folder, | |
# make it executable and run it. | |
# | |
# You could always copy and paste the following command | |
# in the terminal, while being into the hooks folder. | |
find . -name '*.js' -exec chmod u+x {} \; |
This file contains hidden or 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
# So what's happening? Well, "sips" is the command being used | |
# and -Z tells it to maintain the image's aspect ratio. | |
# "640" is the maximum height and width to be used and "*.jpg" | |
# instructs your computer to downsize every image ending in .jpg. | |
# It's really simple and shrinks your images very quickly. | |
# Just be sure to make a copy first if you want to preserve their | |
# larger size as well. | |
# | |
# http://lifehacker.com/5962420/batch-resize-images-quickly-in-the-os-x-terminal | |
# |