Skip to content

Instantly share code, notes, and snippets.

View jeffwilcox's full-sized avatar

Jeff Wilcox jeffwilcox

View GitHub Profile
@jeffwilcox
jeffwilcox / installMongoDB.sh
Last active December 18, 2015 08:09
Used for preparing a simple CentOS VM for MongoDB by adding the 10gen repo and installing the packages.
# Install MongoDB on CentOS
cat > ./10gen.repo << "YUM10GEN"
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1
YUM10GEN
February 2013 Home Workstation
---
Intel Core i7-3770K Ivy Bridge 3.5GHz (3.9GHz Turbo) LGA 1155 77W Quad-Core Desktop Processor Intel HD Graphics 4000 BX80637I73770K
CORSAIR Vengeance 32GB (4 x 8GB) 240-Pin DDR3 SDRAM DDR3 1600 Desktop Memory Model CMZ32GX3M4X1600C10
2x Intel 520 Series Cherryville SSDSC2CW180A310 2.5" 180GB SATA III MLC Internal Solid State Drive (SSD) - OEM
2x Intel 520 Series Cherryville SSDSC2CW120A310 2.5" 120GB SATA III MLC Internal Solid State Drive (SSD) - OEM
GIGABYTE GA-Z77X-UP5 TH LGA 1155 Intel Z77 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard with Dual Thunderbolt
ZALMAN CNPS9900MAX-B 135mm Long life bearing CPU Cooler Blue LED
Antec EarthWatts Green EA-380D Green 380W Continuous power ATX12V v2.3 / EPS12V 80 PLUS BRONZE Certified Active PFC Power ...
Antec Three Hundred Two Case
@jeffwilcox
jeffwilcox / gist:2432351
Created April 20, 2012 22:33
WinRT IsInstanceOfType, IsAssignableFrom
/// <summary>
/// Determines whether the specified object is an instance of the current Type.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="o">The object to compare with the current type.</param>
/// <returns>true if the current Type is in the inheritance hierarchy of the
/// object represented by o, or if the current Type is an interface that o
/// supports. false if neither of these conditions is the case, or if o is
/// null, or if the current Type is an open generic type (that is,
@jeffwilcox
jeffwilcox / gist:2431936
Created April 20, 2012 21:11
Is a PropertyInfo a static property?
public static bool IsStatic(this PropertyInfo propertyInfo)
{
return ((propertyInfo.CanRead && propertyInfo.GetMethod.IsStatic) ||
(propertyInfo.CanWrite && propertyInfo.SetMethod.IsStatic));
}
// So a replacement for getting private and public non-static properties in a type...
public static bool IsStatic(this PropertyInfo propertyInfo)
{
return ((propertyInfo.CanRead && propertyInfo.GetMethod.IsStatic) ||
@jeffwilcox
jeffwilcox / gist:2431507
Created April 20, 2012 20:12
Reflection comparison
// Windows Phone / Standard .NET:
// var mi = dataLoaderType.GetMethod(methodName, paramTypes);
// Windows 8 XAML Metro style app:
var mi = dataLoaderType.GetTypeInfo().GetDeclaredMethods(methodName);
MethodInfo actualMethod = null;
foreach (var method in mi)
{
// Eeeew code.
var parameters = method.GetParameters();
@jeffwilcox
jeffwilcox / WittyBanter.cs
Created January 16, 2012 07:27
Just a fun way to show something different while things are loading.
//
// Copyright (c) 2010-2011 Jeff Wilcox
//
// 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
//
// Unless required by applicable law or agreed to in writing, software
//
// Copyright (c) 2010-2011 Jeff Wilcox
//
// 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
//
// Unless required by applicable law or agreed to in writing, software
@jeffwilcox
jeffwilcox / Generic.xaml
Created February 10, 2011 08:53
Simple stab at a base window class that doesn't use popup but depends on a frame
<Style TargetType="layoutToolkit:HeaderedContentControl">
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="layoutToolkit:HeaderedContentControl">
<StackPanel>
<ContentPresenter
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
@jeffwilcox
jeffwilcox / NegativeMarginHyperlinkButtonSample.xaml
Created December 8, 2010 07:37
A sample hyperlink button for Windows Phone where the negative margins allow for a larger touch target.
<Style
x:Key="AccentHyperlink"
TargetType="HyperlinkButton">
<Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}" />
<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}" />
<Setter Property="Padding" Value="0" />
<Setter Property="Template">
<Setter.Value>