Skip to content

Instantly share code, notes, and snippets.

View timheuer's full-sized avatar
🚴‍♂️
https://twitter.com/timheuer

Tim Heuer timheuer

🚴‍♂️
https://twitter.com/timheuer
View GitHub Profile
diff --git a/src/SQLite.cs b/src/SQLite.cs
index be550e8..164e313 100644
--- a/src/SQLite.cs
+++ b/src/SQLite.cs
@@ -2417,6 +2417,9 @@ namespace SQLite
[DllImport("sqlite3", EntryPoint = "sqlite3_config", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Config (ConfigOption option);
+
+ [DllImport("sqlite3", EntryPoint = "sqlite3_win32_set_directory", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]
diff --git a/src/SQLite.cs b/src/SQLite.cs
index be550e8..164e313 100644
--- a/src/SQLite.cs
+++ b/src/SQLite.cs
@@ -2417,6 +2417,9 @@ namespace SQLite
[DllImport("sqlite3", EntryPoint = "sqlite3_config", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Config (ConfigOption option);
+
+ [DllImport("sqlite3", EntryPoint = "sqlite3_win32_set_directory", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]
@timheuer
timheuer / PathBasedAppBarButtonStyle.xaml
Created September 3, 2012 22:16
PathBasedAppBarButtonStyle
<Style x:Key="PathBasedAppBarButtonStyle" BasedOn="{StaticResource AppBarButtonStyle}" TargetType="ButtonBase">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Path Width="20" Height="20"
Stretch="Uniform"
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Data="{Binding Path=Content, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
</DataTemplate>
</Setter.Value>
@timheuer
timheuer / bytetobitmap.cs
Created September 9, 2012 04:45
byte array to bitmap image
// assume 'img' is a byte[]
BitmapImage bmp = new BitmapImage();
using (var ras = new InMemoryRandomAccessStream())
{
var strm = ras.GetOutputStreamAt(0).AsStreamForWrite();
strm.Write(img, 0, img.Length);
bmp.SetSourceAsync(ras);
@timheuer
timheuer / sqlitewithflags.cs
Created September 10, 2012 23:11
SQLite Open with Flags
var dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "foo.db");
using (var db = new SQLite.SQLiteConnection(dbpath, SQLite.SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite, true))
{
db.DropTable<Person>();
db.CreateTable<Person>();
db.Insert(new Person() { Fullname = "Tim Heuer" });
}
diff --git a/src/Callisto.TestApp/SamplePages/SettingsContent.xaml b/src/Callisto.TestApp/SamplePages/SettingsContent.xaml
index 711fc5c..34f30c9 100644
--- a/src/Callisto.TestApp/SamplePages/SettingsContent.xaml
+++ b/src/Callisto.TestApp/SamplePages/SettingsContent.xaml
@@ -30,6 +30,8 @@ Nunc bibendum accumsan nisi sed fermentum. Integer nec sem mauris. Cum sociis na
Ut eu dui mauris, nec semper urna. Donec tortor enim, blandit id euismod at, porttitor ut justo. Duis euismod magna ac ipsum tristique blandit. Suspendisse at nisi purus. Pellentesque et quam in arcu ultrices placerat. Sed sodales, dui a dapibus malesuada, leo nulla luctus magna, ut vulputate turpis urna in ligula. Nulla gravida enim euismod nulla eleifend cursus. Vestibulum fermentum mi ut erat pulvinar vehicula sagittis libero pulvinar. Suspendisse lacinia risus gravida lectus auctor quis varius purus ultricies. Maecenas vulputate convallis dui ut semper. Morbi diam elit, volutpat vel convallis vel, gravida ut est.
</TextBl
@timheuer
timheuer / AppManifestHelper.cs
Created September 13, 2012 04:32
AppManifestHelper.cs
//
// Copyright (c) 2012 Tim Heuer
//
// Licensed under the Microsoft Public License (Ms-PL) (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://opensource.org/licenses/Ms-PL.html
//
// Unless required by applicable law or agreed to in writing, software
diff --git a/src/SQLite.cs b/src/SQLite.cs
index be550e8..164e313 100644
--- a/src/SQLite.cs
+++ b/src/SQLite.cs
@@ -2417,6 +2417,9 @@ namespace SQLite
[DllImport("sqlite3", EntryPoint = "sqlite3_config", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Config (ConfigOption option);
+
+ [DllImport("sqlite3", EntryPoint = "sqlite3_win32_set_directory", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]
@timheuer
timheuer / somepage.xaml
Created October 24, 2012 21:17
CustomDialog Sample
<callisto:CustomDialog x:FieldModifier="public" x:Name="LoginDialog"
Title="Bacon Terms and Conditions"
Background="Teal">
<StackPanel>
<TextBlock Margin="0,0,0,8" FontSize="14.6667" FontWeight="SemiLight" TextWrapping="Wrap">
Bacon ipsum dolor sit amet bacon ham drumstick strip steak, sausage frankfurter tenderloin turkey salami andouille bresaola. Venison salami prosciutto, pork belly turducken tri-tip spare ribs chicken strip steak fatback shankle tongue boudin andouille. Meatloaf salami pork ground round turkey jerky meatball ball tip, filet mignon fatback flank prosciutto shank. Turkey boudin ham hock, filet mignon tri-tip bresaola tongue venison spare ribs meatloaf flank beef pancetta. Leberkas turducken flank ground round biltong chuck bacon kielbasa. Beef pastrami meatball, short loin venison swine pork loin shank meatloaf spare ribs.
</TextBlock>
<CheckBox Ma
@timheuer
timheuer / foo.bat
Created November 30, 2012 18:24
batch with spaces
SET arch=%processor_architecture%
SET pf="C:\Program Files"
if "%arch%" == "AMD64" (
SET pf="C:\Program Files (x86)"
)
REM below fails because "pf" has spaces in it
REM using "%pf%\bar\baz\file.foo" also fails because then it looks at %pf% as a literal
copy \\some\path\file.foo %pf%\bar\baz\file.foo