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
multiAutoCompleteTextView.setRawInputType(InputType.TYPE_CLASS_TEXT | |
|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | |
|InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | |
|InputType.TYPE_TEXT_FLAG_MULTI_LINE); |
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 an event handler to an element to detect pointer down | |
*Ensure that is a touch event | |
*MSPointerDown and MSPointerUp are Windows 8/IE10 events. You should look at another code to handle gestures on other browsers | |
*/ | |
this._element.addEventListener("MSPointerDown", function (e) { | |
//Touch event | |
if (e.pointerType == 2) { | |
context._gestureInfos = new Object(); | |
context._gestureInfos.started = 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
DWORD dw = GetLastError(); | |
char *TextSize; | |
std::printf("Error has occured: "); | |
FormatMessage(0x00000100 | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, | |
dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | |
(LPTSTR) &TextSize, 0, 0); | |
OutputDebugString((LPCWSTR)TextSize); |
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"); |
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
<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
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
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
using System; | |
using System.IO; | |
using System.IO.IsolatedStorage; | |
namespace Tools | |
{ | |
public abstract class ISHelper | |
{ | |
private const string directory = "Storage"; |
OlderNewer