Skip to content

Instantly share code, notes, and snippets.

View joehanna's full-sized avatar

Joe Hanna joehanna

View GitHub Profile
@joehanna
joehanna / Layout.cs
Created June 21, 2016 07:43 — forked from praeclarum/Layout.cs
A C# syntax for NSLayoutConstraints.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using UIKit;
namespace Async.iOS
{
public static class Layout
{
@joehanna
joehanna / osx-defaults.sh
Created May 24, 2016 11:36 — forked from Alanaktion/osx-defaults.sh
OS X Defaults
# I have issues with OS X's defaults. Luckily, most are easy to change.
# This is heavily based on saetia's gist: https://gist.github.com/saetia/1623487
# Disable autocomplete, which effectively disables that really stupid Escape key autocomplete handler
defaults write -g NSUseSpellCheckerForCompletions -bool false
# Disable window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
# Expand save panel by default
@joehanna
joehanna / Sublime Theme - Dark
Created September 18, 2015 01:20
This is based on the "Ashphalt" theme - but has added current line and selection highlighting. I would alway lose the cursor without this!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>author</key>
<string>O&apos;rlmente?</string>
@joehanna
joehanna / TestParseEnum.cs
Last active August 29, 2015 14:20
Test Parsing Enum
using System;
using System.Diagnostics;
namespace EnumParsing
{
class TestParseEnum
{
enum DebugLevelEnum : int
{
Invalid = -1,
@joehanna
joehanna / gist:428c29e92ad1cf4de9c9
Created April 1, 2015 02:14
VB: Extracting the Version from a dotnet Assembly
' (From Eyewear Stock & Sales project)
Imports System.Reflection
Public Class ctlFooter
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim t As Type = GetType(ctlFooter)
@joehanna
joehanna / gist:79b1842f4516570fd3cc
Created March 30, 2015 23:42
VBA: Open Windows Explorer with a specific file selected
Dim fileName as String
fileName = "C:\Windows\notepad.exe"
Shell "explorer.exe /e,/select," & fileName, vbNormalFocus
@joehanna
joehanna / gist:4eaa64d8e34e9d8e2646
Created March 23, 2015 00:21
Generate a GUID from VBA or VBScript
Function GenGuid() As String
Dim TypeLib As Object
Dim guid As String
Dim guid2 As String
Set TypeLib = CreateObject("Scriptlet.TypeLib")
guid = Left$(TypeLib.guid, 38)
Set TypeLib = Nothing
' format is {24DD18D4-C902-497F-A64B-28B2FA741661}
guid = Replace(guid, "{", "")
@joehanna
joehanna / gist:e2a1566a3326e42c2141
Created February 24, 2015 12:51
iOS Screen Frame / Bounds
var frame = UIApplication.SharedApplication.KeyWindow.Screen.Bounds;
@joehanna
joehanna / gist:e3fe05bc7b1394b641fa
Created February 24, 2015 10:25
Xamarin iOS - refreshing on the viewable rows in a UITableView
//As suggested by @TomPratt http://forums.xamarin.com/discussion/28460/uitableview-update-the-cells-not-a-full-reload
tableView.BeginUpdates();
tableView.ReloadRows(tableView.IndexPathsForVisibleRows, UITableViewRowAnimation.Automatic);
tableView.EndUpdates();
@joehanna
joehanna / gist:7058166818a61815cfe8
Created February 10, 2015 05:43
C# Web Headers to force expiry of pages so Back Button does not show sensitive data after logout
Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0.
Response.AppendHeader("Expires", "0"); // Proxies.