Skip to content

Instantly share code, notes, and snippets.

Jake Wharton JakeWharton

Block or report user

Report or block JakeWharton

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
@JakeWharton
JakeWharton / seven_seg.py
Created Apr 14, 2009
Python function to generate seven-segment number strings. Derived from Knio.
View seven_seg.py
def seven_seg(x):
'''
_ _ _ _ _ _ _ _
|_||_| ||_ |_ |_| _| _| || |
_||_| ||_| _| | _||_ ||_|
1111101101 = 1005
1101110001 = 881
1101111100 = 892
@JakeWharton
JakeWharton / gist:154713
Created Jul 25, 2009
Rudimentary implementation of pyy_tag/html_tag in C#
View gist:154713
using System;
using System.Text;
using System.Reflection;
namespace pyysharp
{
public abstract class HtmlTag
{
private static string TAB = " ";
@JakeWharton
JakeWharton / Impersonator.cs
Created Nov 5, 2009
Allows you to execute code under another user's privileges.
View Impersonator.cs
using System;
using System.Runtime.InteropServices;
using System.Security.Principal;
namespace JakeWharton
{
public class Impersonator : IDisposable
{
private WindowsImpersonationContext ImpersonatedUser = null;
private IntPtr UserHandle;
@JakeWharton
JakeWharton / hookpuller.py
Created Nov 7, 2009
Takes a GitHub service hook POST and automatically updates the associated repo.
View hookpuller.py
#!/usr/bin/env python
'''
Takes a GitHub service hook POST and automatically updates the associated repo.
'''
__license__ = '''
Copyright 2009 Jake Wharton
hookpuller is free software: you can redistribute it and/or modify
@JakeWharton
JakeWharton / ExpressionEvaluator.java
Created Nov 18, 2009
Java class to parse, evaluate, and convert between infix, prefix, and postfix expressions.
View ExpressionEvaluator.java
import java.util.ArrayList;
/***
* @name Expression Evaluator
* @author Jake Wharton
* @date 2005-11-07
*/
public class ExpressionEvaluator
{
public static enum EXPRESSIONTYPE
View rcdict_thoughts.py
from rcdict import *
class User: pass
class Group(Model):
name = StringField()
admin = ForeignKey(User)
#users = ReverseForeignKey(User) generated automatically
class User(Model):
@JakeWharton
JakeWharton / post-receive
Created Apr 9, 2010
git post-receive hook for updating Trac 0.12
View post-receive
#!/usr/bin/python
import sys
import subprocess
GIT_PATH = '/usr/bin/git'
TRAC_ADMIN_PATH = '/usr/local/bin/trac-admin'
VALID_BRANCHES = ['master']
TRAC_ENV = '/path/to/trac'
View music-converter.pl
#!/usr/bin/perl -w
use strict;
use warnings;
use File::Basename;
use Getopt::Long;
#########################################################
# Flac to Mp3 Perl Converter - Terminal Edition
# Created by: Somnorific
# Based on: Scripts by Falkano and Nick Sklaventitis
@JakeWharton
JakeWharton / gist:506573
Created Aug 3, 2010
Disable any lazy loading of table properties by magical reflection voodoo
View gist:506573
namespace JakeWharton.Utilities
{
public static class DataContextExtensions
{
/// <summary>
/// Disable any lazy loading of table properties by magical reflection voodoo.
///
/// See: http://stackoverflow.com/questions/3388276/disable-all-lazy-loading-or-force-eager-loading-for-a-linq-context
/// And: http://stackoverflow.com/questions/3396426/iterating-tables-in-a-context-and-the-properties-of-those-tables
/// And: http://stackoverflow.com/questions/3397843/how-to-determine-lazy-loaded-properties-at-runtime-on-a-linq-table
@JakeWharton
JakeWharton / IconCheckBoxPreference.java
Created Aug 9, 2010
IconCheckBoxPreference: An Android CheckBox preference with an optional Icon
View IconCheckBoxPreference.java
package com.jakewharton.utilities;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import com.jakewharton.wakkawallpaper.R;
You can’t perform that action at this time.