Skip to content

Instantly share code, notes, and snippets.

💭
(•_•) ( •_•)>⌐■-■ (⌐■_■)

E.Z. Hart hartez

💭
(•_•) ( •_•)>⌐■-■ (⌐■_■)
Block or report user

Report or block hartez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hartez
hartez / TranslatePage.cs
Last active Oct 4, 2017
View accepts input after translation
View TranslatePage.cs
public class TranslatePage : ContentPage
{
public TranslatePage()
{
var layout = new RelativeLayout();
double viewSize = 100;
var box = new Entry
{
@hartez
hartez / TranslatePage.cs
Created Oct 3, 2017
Add gesture to off-screen view, animate it onto the screen, gesture still works
View TranslatePage.cs
public class TranslatePage : ContentPage
{
public TranslatePage()
{
var layout = new RelativeLayout();
var tapGesture = new TapGestureRecognizer
{
Command = new Command(() => DisplayAlert("Box Tapped", "The box was tapped", "Cool, thanks."))
};
View keybase.md

Keybase proof

I hereby claim:

  • I am hartez on github.
  • I am hartez (https://keybase.io/hartez) on keybase.
  • I have a public key ASDHDfsQ0rypUYqHl9WtalmOx-BzQgjxRscWRqnmdtVdpAo

To claim this, I am signing this object:

@hartez
hartez / bodytext.ps1
Last active Feb 9, 2017
PowerShell script to pull email body text out of GMVault
View bodytext.ps1
$emails = @()
$gmvaultdb = "[path to your gmvault data]"
$total = (Get-ChildItem $gmvaultdb -Recurse -Filter *.eml | measure).Count
Add-Type -Path "MimeKit.1.2.10.0\lib\net45\MimeKit.dll"
$formats = @{
[MimeKit.Text.TextFormat]::Text = 0;
@hartez
hartez / emailwordcounts.py
Created Oct 25, 2015
Python script for counting words in emails
View emailwordcounts.py
from bs4 import BeautifulSoup as bsoup
import pandas as pd
import numpy as np
import humanfriendly
# Read in email data file
df = pd.read_csv('../bodytext.csv', header = 0)
# Filter out sent mail
emails = df.query('FromEmail != "[my email address]"').copy()
@hartez
hartez / attachments3.py
Created Oct 4, 2015
Plotting email attachment data using pandas
View attachments3.py
import pandas as pd
import numpy as np
import humanfriendly
import matplotlib.pyplot as plt
plt.style.use('ggplot')
import os.path
# Read in our email data file
df = pd.read_csv('../attachments2.csv', header = 0)
@hartez
hartez / RefactorableSettingsTemplate.tt
Created Aug 15, 2014
T4 template for generating refactorable settings
View RefactorableSettingsTemplate.tt
<#@ template language="C#" hostspecific="True" #>
<#@ assembly name="System.Xml" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Xml" #>
<#
XmlDocument doc = new XmlDocument();
doc.Load(Path.Combine(Path.GetDirectoryName(Host.TemplateFile), "Settings.settings"));
string xmlns = doc.DocumentElement.Attributes["xmlns"].Value;
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
@hartez
hartez / AddressController.cs
Created Jun 23, 2014
Address controller with comments
View AddressController.cs
/// <summary>
/// Endpoints for managing Addresses
/// </summary>
public class AddressController : ApiController
{
/// <summary>
/// Gets a list of addresses in the system
/// </summary>
/// <returns>IEnumerable&lt;AddressViewModel&gt;.</returns>
public IEnumerable<AddressViewModel> Get()
@hartez
hartez / AddressController.cs
Created Jun 23, 2014
Controller without documentation
View AddressController.cs
public class AddressController : ApiController
{
public IEnumerable<AddressViewModel> Get()
{
return Addresses.Get();
}
[Route(Name = "GetAddress")]
public AddressViewModel Get(int id)
{
@hartez
hartez / gist:3881054
Created Oct 12, 2012
Convertinator temperature
View gist:3881054
var temperature = new ConversionGraph();
var fahrenheit = new Unit("degrees Fahrenheit")
.IsAlsoCalled("Fahrenheit")
.CanBeAbbreviated("°F")
.PluralizeAs("°F");
temperature.AddConversion(
Conversions.From(fahrenheit).To(celcius).Subtract(32).MultiplyBy(5M / 9M));
You can’t perform that action at this time.