Skip to content

Instantly share code, notes, and snippets.

@hartez
hartez / jquery-validation-engine_with_select2
Created June 25, 2012 22:27
Workaround for using jquery-validation-engine with select2 for 'required' validation
<script type="text/javascript">
// This is a workaround for using jquery-validation-engine with select2 for 'required' validation
// Since the _required validator for jquery-validation-engine uses .val() to see
// if there's anything in the input, we can hijack .val() for the container created by select2\
// and redirect it to the value of the hidden element
// jquery-validation-engine throws an error if the thing we're validating doesn't have an id
// so we'll put one on the container created by select2 (that way, the positioning of the prompts
// will be correct)
$('#mySelector').select2('container').attr('id', 'mySelectorValidate');
@hartez
hartez / bodytext.ps1
Last active February 9, 2017 18:10
PowerShell script to pull email body text out of GMVault
$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;

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 / TranslatePage.cs
Created October 3, 2017 22:07
Add gesture to off-screen view, animate it onto the screen, gesture still works
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."))
};
@hartez
hartez / TranslatePage.cs
Last active October 4, 2017 20:24
View accepts input after translation
public class TranslatePage : ContentPage
{
public TranslatePage()
{
var layout = new RelativeLayout();
double viewSize = 100;
var box = new Entry
{
@hartez
hartez / emailwordcounts.py
Created October 25, 2015 20:44
Python script for counting words in emails
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()