Skip to content

Instantly share code, notes, and snippets.

View SteGriff's full-sized avatar
🪴
Springing

Stephen Griffiths SteGriff

🪴
Springing
View GitHub Profile
@SteGriff
SteGriff / bigedit.htm
Created July 27, 2017 14:04
Big Editor
<!DOCTYPE HTML>
<html>
<head>
<title>Big Edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body
{
font-family: -apple-system, BlinkMacSystemFont, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
@SteGriff
SteGriff / attributes.htm
Created August 15, 2017 15:17
Custom HTML attributes in pure JavaScript
<button type="button"
submit-item
data-url="/Controller/Action"
data-item-code="ABC123">Submit ABC123</button>
<script>
//Helper to get data-items without jQuery
Object.prototype.data = function(x)
{
@SteGriff
SteGriff / ResourceTypes-2017-11-06.txt
Created November 6, 2017 18:08
All Azure Resource Types used in gallery templates
Microsoft.ApiManagement/service
Microsoft.ApiManagement/service/providers/diagnosticSettings
Microsoft.Authorization/roleAssignments
Microsoft.Automation/automationAccounts
Microsoft.Automation/automationAccounts/modules
Microsoft.Automation/automationAccounts/runbooks
Microsoft.Backup/BackupVault
Microsoft.Backup/BackupVault/registeredContainers/protectedItems
Microsoft.Batch/batchAccounts
Microsoft.Cache/Redis
@SteGriff
SteGriff / Get-Azure-Resource-Types.ps1
Created November 6, 2017 18:10
PowerShell script to recurse thru azure-quickstart-templates, pulling out every azuredeploy.json file and listing the Resource.Types they use
# PowerShell script to recurse thru github.com/azure/azure-quickstart-templates,
# pulling out every azuredeploy.json file and listing the Resource.Types they use
# Initialise an empty list of $types and an optional $limit for how many files to process
$types = @()
$limit = 100
# Set up your cloned repo directory here
$directory = 'C:\Projects\Ste\azure-quickstart-templates'
cd $directory
@SteGriff
SteGriff / Get-WindowsAzurePowerShellVersion.ps1
Created November 7, 2017 11:47
PowerShell cmdlet to get current Azure PowerShell tools version
# Originally from http://www.maxtblog.com/2014/03/find-your-windows-azure-powershell-cmdlets-version
function Get-WindowsAzurePowerShellVersion
{
[CmdletBinding()]
Param ()
## - Section to query local system for Windows Azure PowerShell version already installed:
Write-Host "Windows Azure PowerShell Installed version: "
(Get-Module -ListAvailable | Where-Object{ $_.Name -eq 'Azure' }) |
@SteGriff
SteGriff / RegAsm.bat
Created November 9, 2017 10:19
A foolproof 32/64 bit regasm script
@echo off
REM
REM Fill in your DLL directory on the cd line
REM Fill in your DLL name on the two RegAsm lines
REM
echo "Registering (thing)..."
cd "%programfiles(x86)%\Location\OfMy\Library"
echo "Changed directory. Trying 32 bit..."
%WINDIR%\Microsoft.Net\Framework\v4.0.30319\RegAsm.exe MyLibrary.dll /tlb /codebase
if ERRORLEVEL 100 (
@SteGriff
SteGriff / base.htm
Last active August 14, 2023 14:17
Base HTML
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Hello</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" href="/css/tachyons.css"> -->
<style>
</style>
@SteGriff
SteGriff / clock.htm
Created April 11, 2018 09:08
Vanilla JS loading indicator using Unicode clocks
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.big{font-size:120%;}
</style>
</head>
@SteGriff
SteGriff / LinqSingleBehaviour.cs
Created April 17, 2018 14:37
How does LINQ Single behave?
class Program
{
static void Main(string[] args)
{
var myListOfNone = new List<Dog>();
var myListOfOne = new List<Dog>() { new Dog("Fido", 5) };
var myListOfSeveral = new List<Dog>() { new Dog("Fido", 5), new Dog("Lassy", 14) };
var b = myListOfNone.SingleOrDefault(); //Null
@SteGriff
SteGriff / generate-drop-constraints.sql
Created September 26, 2018 09:30
Generate DROP statements for FK constriants
select
concat('alter table ', table_name, ' drop foreign key ', constraint_name, ';')
from
information_schema.key_column_usage
where
referenced_table_name is not null
and table_schema = 'MyTableName';