Skip to content

Instantly share code, notes, and snippets.

View elliz's full-sized avatar

Sam Ellis elliz

  • Perth, Western Australia
View GitHub Profile
@elliz
elliz / TampermonkeyFavicon.js
Last active February 21, 2024 05:26
Tampermonkey script to update Favicon with data-uri SVG for Chrome 80+ etc
// ==UserScript==
// @name SVG Favicon test
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Update the favicon on a site
// @author You
// @match https://elliz.github.io/svg-favicon/
// @grant none
// ==/UserScript==
// Bookmarklet for Azure DevOps work items
// Select a number, click bookmarklet and open workitem with that id in new window
// Can edit using tools such as http://subsimple.com/bookmarklets/jsbuilder.htm
// based on code found at https://stackoverflow.com/questions/26261323
javascript:
(function(){
const path = 'your/path-here'; // usually Domain/projectId
s=document.selection?document.selection.createRange().text:window.getSelection?window.getSelection().toString():document.getSelection?document.getSelection():'';
if(s==''){
s=prompt('Enter%20ID%20of%20workitem%20:','');

Different git creds for different repos

TODO confirm this for windows

In global gitconfig -- on windows in Program Files/Git/etc

# xxxxxxx Projects
[includeIf "gitdir:<path to dir you're interested in>/**"]
    path = path to specific gitconfig created for this project
@elliz
elliz / git notepad editor.bat
Last active July 22, 2020 02:05
windows command to set Notepad++ as your git editor (for squashes, rebases etc). Make you changes, save, close window.
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
@elliz
elliz / Clickable.svg
Last active August 20, 2020 08:50
SVG that shows local coords on hover NOTE will not work on github as js script blocked
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# From Admin PS Shell:
Install-Module -Name AzureAD
Connect-AzureAD
Get-AzureADUser -ObjectId "your email address"
@elliz
elliz / Optus E5186 Domain name.js
Last active September 22, 2021 03:08
Optus Huawei E5186 Domain Name Filter TamperMonkey script
// ==UserScript==
// @name Optus - Domain Name Filter
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author You
// @match http://192.168.8.1/html/urlfilter.html
// @grant GM_addStyle
// ==/UserScript==

Video script

  1. Script your intro, and use it consistently
    • e.g. Hi, I'm {YourName} and today I am working on {ProjectName} and I have just finished {FeatureName}. Let's take a look.
  2. Demo the new feature, focused on the acceptance criteria.
  3. Script your outro - e.g. That's it for this feature, looking forward to your feedback. Thanks for watching!
  4. Do it in one take, if something fails. Just say "whoops", pause the video, fix it, and resume. Nobody will mind.
@elliz
elliz / polygon-area-tests.cs
Last active January 14, 2022 01:03
Polygon Area Tests
// Testing code via Stack Overflow answer at:
// https://stackoverflow.com/a/16281192/581414
void Main()
{
var square = new List<Point>{
new Point(1, 1),
new Point(1, 10),
new Point(10,10),
new Point(10,1),
@elliz
elliz / CreateCosmosDbUdf.cs
Created February 16, 2022 05:04
Create a CosmosDb User Defined Function using .NET SDK
using Microsoft.Azure.Cosmos;
using Microsoft.Azure.Cosmos.Scripts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace GoesHere
{