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
@timheuer
timheuer / readmore.xaml
Created December 21, 2012 21:44
hack for a read more block
<RichTextBlock>
<Paragraph>
<InlineUIContainer>
<StackPanel>
<TextBlock Text="Some text here" />
<HyperlinkButton x:Name="ReadMoreLink" Content="READ MORE" Click="HyperlinkButton_Click_1" />
<TextBlock x:Name="HiddenText" Text="Some other text" Visibility="Collapsed" />
</StackPanel>
</InlineUIContainer>
</Paragraph>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
Loaded += MainPage_Loaded;
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
@timheuer
timheuer / FixingScalarNull.diff
Created July 11, 2013 18:58
Fixing ExecuteScalar<T> when null coltype
diff --git a/src/SQLite.cs b/src/SQLite.cs
index 5bd252d..af15cf5 100644
--- a/src/SQLite.cs
+++ b/src/SQLite.cs
@@ -1974,7 +1974,9 @@ public T ExecuteScalar<T> ()
var r = SQLite3.Step (stmt);
if (r == SQLite3.Result.Row) {
var colType = SQLite3.ColumnType (stmt, 0);
- val = (T)ReadCol (stmt, 0, colType, typeof(T));
+ if (colType != SQLite3.ColumnType.Null) {
@timheuer
timheuer / logotopath.xaml
Created September 4, 2013 21:56
vector logo in xaml path data
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="Layer_3_11" Width="314.667" Height="157.333" Canvas.Left="0" Canvas.Top="0">
<Path Width="37.2133" Height="40.0697" Canvas.Left="256.672" Canvas.Top="72.5756" Stretch="Fill" Fill="#FF777777" Data="F1 M 293.885,78.5093C 292.156,81.1293 291.527,84.2813 291,87.5667C 290.355,91.5667 289.672,95.4053 288.256,99.172C 286.557,103.681 283.704,108.713 278.735,112.645C 273.568,98.6667 266.052,85.828 256.672,74.5987C 262.589,72.2333 268.401,72.2707 273.177,73.0573C 277.147,73.7133 280.813,75.0467 284.604,76.484C 287.708,77.672 290.756,78.7027 293.885,78.5093 Z "/>
<Path Width="40.1224" Height="37.2347" Canvas.Left="202.052" Canvas.Top="20.864" Stretch="Fill" Fill="#FF777777" Data="F1 M 236.24,20.864C 236.047,24 237.079,27.0413 238.265,30.1507C 239.704,33.9373 241.037,37.604 241.693,41.572C 242.48,46.3533 242.516,52.172 240.147,58.0987C 228.901,48.7293 216.047,41.2293 202.052,36.0827C
<Style x:Key="InvertedNumericUpDownStyle" TargetType="callisto:NumericUpDown">
<Setter Property="MinWidth" Value="100" />
<Setter Property="MinHeight" Value="{StaticResource TextControlThemeMinHeight}" />
<Setter Property="Foreground" Value="{StaticResource TextBoxForegroundThemeBrush}" />
<Setter Property="Background" Value="{StaticResource TextBoxBackgroundThemeBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource TextControlBorderThemeThickness}" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
POST https://api.teamsnap.com/v2/authentication/login HTTP/1.1
X-Teamsnap-User: <removed-for-gist>
X-Teamsnap-Password: <removed-for-gist>
Host: api.teamsnap.com
Content-Length: 0
HTTP/1.1 400 Bad Request
Server: nginx/1.4.5 + Phusion Passenger 3.0.21
X-Rack-Cache: invalidate, pass
Cache-Control: no-cache
JSON:
[
{
team: {
international_date: false,
is_coed: false,
team_name: "foo bar"
}
},
{
// http://msdn.microsoft.com/en-us/library/ms646301.aspx
[DllImport("user32.dll")]
internal static extern short GetKeyState(int keyCode);
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
internal static bool IsCapsLockOn()
{
return (KeyStateHelper.GetKeyState((int)VirtualKey.CapitalLock)) != 0;
@timheuer
timheuer / Person.cs
Created May 15, 2014 13:49
VMFormatted
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string FullName
{
get { return string.Format("{0} {1}", FirstName, LastName);
}
@timheuer
timheuer / sqlitememorystore.cs
Created June 27, 2014 17:13
SQlite Memory Store
var dbPath = Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "somedb.db");
using (var db = new SQLite.SQLiteConnection(dbPath))
{
// set this to memory instead of directory
db.Execute("PRAGMA temp_store = memory;");
// do your other stuff
}