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
/* | |
* From Google IO 2014 app | |
* Copyright 2014 Google Inc. All rights reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
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
/** | |
* Awesome method to create an array from an object using Reflection. Useful for JSON serialization | |
* @return array : array of object properties. | |
*/ | |
public function asArray() | |
{ | |
$reflectionClass = new ReflectionClass(get_class($this)); | |
$array = array(); | |
foreach ($reflectionClass->getProperties() as $property) { | |
$property->setAccessible(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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.5+' | |
} | |
} | |
apply plugin: 'android' |
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
using Microsoft.Phone.Tasks; | |
using System; | |
namespace Tools | |
{ | |
public abstract class TaskHelper | |
{ | |
/// <summary> | |
/// Launch a share task | |
/// </summary> |
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
using System; | |
using System.IO; | |
using System.IO.IsolatedStorage; | |
namespace Tools | |
{ | |
public abstract class ISHelper | |
{ | |
private const string directory = "Storage"; |
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
using System; | |
using System.Net; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Documents; | |
using System.Windows.Ink; | |
using System.Windows.Input; | |
using System.Windows.Media; | |
using System.Windows.Media.Animation; | |
using System.Windows.Shapes; |
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
private string GetResourceContent(string path) | |
{ | |
var resource = App.GetResourceStream(new Uri(path, UriKind.Relative)); | |
StreamReader reader = new StreamReader(resource.Stream, Encoding.UTF8); | |
return reader.ReadToEnd(); | |
} |
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
<main> | |
<input placeholder="Search, or say Google" x-webkit-speech autocomplete="off" /> | |
<header></header> | |
<section class="card"> | |
<h1><strong>32 minutes</strong> to Consol Energy Center</h1> | |
<h2>McKnight Road</h2> | |
<div class="map"></div> |
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
isAndroid = function(){ | |
return navigator.userAgent.toLowerCase().indexOf("android") > -1; | |
} | |
isIOS = function(){ | |
return navigator.userAgent.match( /(iPod|iPhone|iPad)/ ); | |
} | |
isWP = function(){ | |
return navigator.userAgent.indexOf("Windows Phone OS") > -1; | |
} | |
isBB = 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
//Adapted from http://stackoverflow.com/questions/3460004/regexp-to-search-replace-only-text-not-in-html-attribute | |
var reg = new RegExp("(?![^<>]*>) *("+search+") *([^ \d])", "g"); | |
var resultsWithoutHTML = text.replace(reg, "toReplace"); |