Skip to content

Instantly share code, notes, and snippets.

View appakz's full-sized avatar

Jesse Taber appakz

  • Articulate
  • Tallahassee, FL
View GitHub Profile
<form id="create_pdf_form">
<fieldset>
<legend>Create Customer Info Sheet PDF</legend>
<div>
<label id="first_name_prompt_id" for="first_name_input_id">First Name</label>
<input name="first_name_input" id="first_name_input_id"/>
</div>
<div>
<label id="last_name_prompt_id" for="last_name_input_id">Last Name</label>
<input name="last_name_input" id="last_name_input_id"/>
@appakz
appakz / file_timestamp_to_datetime.cs
Created October 18, 2015 20:33
Windows File Timestamp ticks to DateTime
const long fileTimestampTicks = 130892436116060259;
var windowsFileTimestampDate = DateTime.FromFileTime(fileTimestampTicks);
@appakz
appakz / ticks_comparison.cs
Created October 18, 2015 20:22
Compare DateTime.Ticks with Windows File Timestamp ticks
var utcNowTicks = DateTime.UtcNow.Ticks;
const long fileTimestampTicks = 130892436116060259;
var ticksDiff = utcNowTicks - fileTimestampTicks;
var ticksDifTimeSpan = TimeSpan.FromTicks(ticksDiff);
var totalYears = ticksDifTimeSpan.TotalDays/365;
Console.WriteLine(totalYears);
@appakz
appakz / datetime_ticks_ctor.cs
Created October 18, 2015 20:08
Construct DateTime from Ticks
const long ticks = 635807955799055730;
var someDate = new DateTime(ticksValue);
@appakz
appakz / sample_sms_data.xml
Last active October 18, 2015 13:45
Sample Windows Phone SMS Data Export
<Message>
<Recepients />
<Body>Hello World!</Body>
<IsIncoming>true</IsIncoming>
<IsRead>true</IsRead>
<Attachments />
<LocalTimestamp>130892436116060259</LocalTimestamp>
<Sender>+15555555555</Sender>
</Message>
static void Main(string[] args)
{
do
{
Console.Write("Enter command or 'exit' to quit: > ");
var command = Console.ReadLine();
if ((command ?? string.Empty).Equals("exit", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("Quitting.");
break;
@appakz
appakz / CFClientBase.CFContractSerializerInfo.cs
Created April 1, 2013 02:18
Equals and GetHashCode methods for
namespace Microsoft.Tools.ServiceModel
{
/// <summary>
/// Partial class / struct implementation for doing proper Equals behavior of the CFContactSerializerInfo struct
/// so that it can be properly used in the Dictionary in the CFClientBase.
/// </summary>
/// <typeparam name="TChannel"></typeparam>
public partial class CFClientBase<TChannel>
where TChannel : class
{
@appakz
appakz / gist:3013243
Created June 28, 2012 19:05
SQL Server HierarchyID.IsDescendantOf() behavior
declare @rootId HierarchyId = HierarchyId::Parse('/1/')
declare @descendantId HierarchyId = HierarchyId::Parse('/1/1/')
--make sense:
select @descendantId.IsDescendantOf(@rootId) --returns 1
select @rootId.IsDescendantOf(@descendantId) --returns 0
--not so much sense:
select @descendantId.IsDescendantOf(@descendantId) --returns 1
select @rootId.IsDescendantOf(@rootId) --returns 1
@appakz
appakz / countLOC.ps1
Created January 25, 2012 03:13
Quick and dirty powershell script for counting lines in each file of a folder
#Quick and dirty PS script for counting lines of code in a directory. Output is dumped to a simple CSV file.
#Note that this script doesn't count blank lines.
#Parameters:
# path - the path containing the code files (note that the script will recurse through subfolders
# outputFile - fully qualified path of the file to dump the CSV output
# include (Optional) - file mask(s) to include in the count (deafults to *.*)
# exclude (Optional) - file mask(s) to exclude in the count (defaults to none)
# Example (count lines in target path including *.cs but excluding *.designer.cs)
# .\countLOC.ps1 -path "C:\code\MyProject" -outputFile "C:\code\loc.csv" -include "*.cs" -exclude "*.designer.cs"
param([string]$path, [string]$outputFile, [string]$include = "*.*", [string]$exclude = "")