Skip to content

Instantly share code, notes, and snippets.

View joehanna's full-sized avatar

Joe Hanna joehanna

View GitHub Profile
@joehanna
joehanna / AppShell.xaml
Created September 23, 2019 06:12
AppShell.xaml showing different presentation on iOS and Android
<?xml version="1.0" encoding="UTF-8"?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:vm="clr-namespace:hbt_members_app.ViewModels"
xmlns:local="clr-namespace:hbt_members_app.Views"
Title="testshell1"
x:Class="hbt_members_app.Views.AppShell"
@joehanna
joehanna / joe-panic.sss
Created April 21, 2019 23:16
Coda 2 Dark Theme for v2.7+ based on vanilla panic.sss
comment {
color:#838c95;
font-style:italic;
}
constant.numeric {
color:#6f4ebc;
font-weight:normal;
}
@joehanna
joehanna / soap-curl-shell
Created September 28, 2018 22:25 — forked from gustavohenrique/soap-curl-shell
SOAP request using curl
# request.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="http://sensedia.com/repository/wstoolkit">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>system</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">manager</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">DWk64SMfJ6RxHAKgPRGtPA==</wsse:Nonce>
<wsu:Created>2013-04-17T18:36:54.013Z</wsu:Created>
</wsse:UsernameToken>
@joehanna
joehanna / Mac OS X: Open in Visual Studio Code
Created September 26, 2018 03:01 — forked from tonysneed/Mac OS X: Open in Visual Studio Code
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@joehanna
joehanna / Broken_SQL_UPDATE_logic.sql
Created April 26, 2018 02:38
Broken SQL UPDATE - does not behave correctly when updating parent from child rows
DECLARE @header TABLE ([HeaderID] INT IDENTITY(1, 1)
,[Balance] NUMERIC(28, 6) DEFAULT 0);
DECLARE @lines TABLE ([LineID] INT IDENTITY(1, 1)
,[HeaderID] INT
,[LineAmount] NUMERIC(28, 6) DEFAULT 0);
DECLARE @rc INT;
INSERT INTO @header ([Balance]) VALUES (0); --ID = 1
@joehanna
joehanna / JSON-TSQL.sql
Created November 2, 2017 22:29 — forked from puleos/JSON-TSQL.sql
Json Parse Functions for MS SQL (by Phil Factor)
IF OBJECT_ID (N'dbo.parseJSON') IS NOT NULL
DROP FUNCTION dbo.parseJSON
GO
CREATE FUNCTION dbo.parseJSON( @JSON NVARCHAR(MAX))
RETURNS @hierarchy TABLE
(
element_id INT IDENTITY(1, 1) NOT NULL, /* internal surrogate primary key gives the order of parsing and the list order */
parent_ID INT,/* if the element has a parent then it is in this column. The document is the ultimate parent, so you can get the structure from recursing from the document */
Object_ID INT,/* each list or object has an object id. This ties all elements to a parent. Lists are treated as objects here */
@joehanna
joehanna / gist:711dcd824f2154a9313ec2f59fd406fb
Created June 16, 2017 06:29 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@joehanna
joehanna / git-mv-with-history
Created January 17, 2017 04:24 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@joehanna
joehanna / SlackClient.cs
Created November 4, 2016 00:08 — forked from jogleasonjr/SlackClient.cs
A simple C# class to post messages to a Slack channel. You must have the Incoming WebHooks Integration enabled. This class uses the Newtonsoft Json.NET serializer available via NuGet. Scroll down for an example test method and a LinqPad snippet. Enjoy!
using Newtonsoft.Json;
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;
//A simple C# class to post messages to a Slack channel
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet
public class SlackClient
{
@joehanna
joehanna / main.cs
Last active August 10, 2016 02:34
HelloEmployeeTest
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
public class Employee
{
public Employee(string lastName, string firstName) {
FirstName = firstName;
LastName = lastName;
}