Skip to content

Instantly share code, notes, and snippets.

View dragthor's full-sized avatar

Kristofer Krause dragthor

View GitHub Profile
private async void Image_PointerPressed(object sender, PointerRoutedEventArgs e)
{
var img = e.OriginalSource as Windows.UI.Xaml.Controls.Image;
if (img == null) return;
var title = img.Tag as string;
// The object for controlling the speech-synthesis engine (voice).
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
private void Image_PointerPressed(object sender, PointerRoutedEventArgs e)
{
var img = e.OriginalSource as Windows.UI.Xaml.Controls.Image;
if (img == null) return;
var title = img.Tag as string;
// The object for controlling the speech-synthesis engine (voice).
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
<MediaElement Name="media" AutoPlay="True"></MediaElement>
#!/bin/bash
sudo apt-get install build-essential automake checkinstall intltool git
sudo apt-get install mono-complete mono-addins-utils gtk-sharp2 gnome-sharp2
git clone git://github.com/mono/monodevelop
cd monodevelop
git checkout monodevelop-4.0
git submodule update --init --recursive
./configure
/* Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
if (networkStatus == NotReachable) {
NSLog(@"There IS NO internet connection");
} else {
NSLog(@"There IS internet connection");
} */
/*
File: Reachability.m
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.2
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.2
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
@dragthor
dragthor / gist:4205461
Created December 4, 2012 15:58
iOS get resource path for writing sqlite3 database
// Get documents directory
NSString *documentsDirectory = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
documentsDirectory = [paths objectAtIndex: 0];
NSString *targetPath = [documentsDirectory stringByAppendingPathComponent:@"todo.db"];
if (![[NSFileManager defaultManager] fileExistsAtPath: targetPath]) {
NSString *sourcePath = [[NSBundle mainBundle] pathForResource:@"todo" ofType:@"db"];
@dragthor
dragthor / gist:2661641
Created May 11, 2012 18:46
Triangle Puzzle Answer
var data = [
[9235],
[9096, 637],
[973, 3269, 7039],
[3399, 3350, 4788, 7546],
[1739, 8032, 9427, 976, 2476],
[703, 9642, 4232, 1890, 704, 6463],
[9601, 1921, 5655, 1119, 3115, 5920, 1808],
[645, 3674, 246, 2023, 4440, 9607, 4112, 3215],
@dragthor
dragthor / gist:1015081
Created June 8, 2011 18:57
jquery.jsoncookie "size error" unit test
test( "size error", function() {
expect( 2 );
var testValue = "";
var testKey = "test";
// Generates a 4095 byte cookie.
for (var i = 0; i < 4089 - testKey.length; i++) { testValue += "a"; }
raises( function() { $.cookie( testKey, testValue ) }, "size error thrown");