Skip to content

Instantly share code, notes, and snippets.

View david-risney's full-sized avatar
🕴️

David Risney david-risney

🕴️
View GitHub Profile
@david-risney
david-risney / gist:af03e49e123351c9cbad4bd2ccade63f
Created May 6, 2022 22:55
Toast from PowerShell when long running command line finishes
copy function:prompt function:poshPrompt;
function prompt {
try {
poshPrompt;
} catch {
Write-Host ("POSH Prompt Error: " + $_);
}
try {
$lastCommandFailed = ($LastExitCode -ne $null -and $LastExitCode -ne 0) -or !$?;
@david-risney
david-risney / TerminalClickable.format.ps1xml
Created May 6, 2022 22:43
PowerShell clickable directory listing
<?xml version="1.0" encoding="utf-8" ?>
<!-- Based on the format.ps1xml file from Terminal-Icons
https://github.com/devblackops/Terminal-Icons/blob/main/Terminal-Icons/Terminal-Icons.format.ps1xml -->
<Configuration>
<SelectionSets>
<SelectionSet>
<Name>FileSystemTypes</Name>
<Types>
<TypeName>System.IO.DirectoryInfo</TypeName>
@david-risney
david-risney / trace.js
Created February 24, 2022 17:59
Watch JavaScript use your objects
function logCall(context, fn) {
const args = Array.prototype.slice.call(arguments, 3);
try {
const r = fn.call(arguments[2], ...args);
console.log(context, "(", ...args, ")", "-->", r);
return r;
} catch (e) {
console.log(context, "(", ...args, ")", "--excpetion-->", e);
throw e;
}
@david-risney
david-risney / JavaScriptDataBreakpoint.js
Created June 15, 2016 17:45
JavaScript data breakpoint
function ValueBreakpoint(parent, fullNamePath) {
var name = fullNamePath[0];
var childNamePath = fullNamePath.slice(1);
var innerValue = parent[name];
var childBreakpoints = [];
function applyChildValueBreakpoints() {
if (childNamePath.length > 0 && innerValue) {
childBreakpoints.push(new ValueBreakpoint(innerValue, childNamePath));
}
This code won't run - just trying to get the idea across of how we might replace registerProtocolHandler, but only if register and registee both agree to use the replacement.
Page that wants to register:
<iframe class="hidden" src="http://you.github.io/registerProtocolHandler/" id="registerProtocolHandler"></iframe>
<script>
document.getElementById("registerProtocolHandler").contentWindow.postMessage({
operation: "setRegistration",
scheme: "web+action",
handler: "http://me.com/?url=%s"
@david-risney
david-risney / JavaScriptTypesAndWinRTTypes.md
Last active February 2, 2016 19:30
JavaScript Types & WinRT Types
WinRT Conversion JavaScript
Struct ↔️ JavaScript object with matching property names
Class or interface instance JavaScript object with matching property names
Windows.Foundation.Collections.IPropertySet JavaScript object with arbitrary property names
Any DOM object
@david-risney
david-risney / _vimrc
Last active August 29, 2015 14:04
_vimrc
syntax on
color evening
set ts=4
set sw=4
set expandtab
set ai
set nohls
set incsearch