Skip to content

Instantly share code, notes, and snippets.

View SeanSobey's full-sized avatar

Sean Sobey SeanSobey

  • SA HomeLoans
  • South Africa
View GitHub Profile
@SeanSobey
SeanSobey / createSpyObjFactory.ts
Created September 15, 2017 06:44
Dynamic spy object factory for Jasmine.
export function createSpyObjFactory<T>(ctor: new (...args: Array<any>) => T, includeProto?: boolean, ...args: Array<string>): () => jasmine.SpyObj<T> {
return () => includeProto
? jasmine.createSpyObj<T>(ctor.name, Object.getOwnPropertyNames(ctor.prototype).concat(Object.getOwnPropertyNames(Object.getPrototypeOf(ctor).prototype)).concat(args))
: jasmine.createSpyObj<T>(ctor.name, Object.getOwnPropertyNames(ctor.prototype).concat(args));
}
@SeanSobey
SeanSobey / portainer.md
Last active April 7, 2024 18:46
Portainer Setup on Windows 10

Portainer on Windows 10

Here I have 2 methods for running portainer on windows, a quick, preferred method only requiring a fairly recent version of docker, or a more complicated method to try if that does not work.

Using host.docker.internal

This setup will let you run Portainer on windows by using the host.docker.internal endpoint (docker.for.win.localhost is depricated since docker version 3.2.1, but older versions may use this instead).

Please note:

@SeanSobey
SeanSobey / .gitconfig
Created November 6, 2017 07:43
Set VSCode as git mergetool.
[merge]
tool = vscode
[mergetool "vscode"]
cmd = code --wait $MERGED
@SeanSobey
SeanSobey / .gitattributes
Last active November 4, 2022 08:57
Git to diff zip (or any compressed) files. See this (https://tante.cc/2010/06/23/managing-zip-based-file-formats-in-git/) article.
*.[7z,xz,bzip2,gzip,tar,zip,wim,ar,arj,cab,chm,cpio,cramfs,dmg,ext,fat,gpt,hfs,ihex,iso,lzh,lzma,mbr,.msi,nsis,ntfs,qcow2,rar,rpm,squashfs,udf,uefi,vdi,vhd,vmdk,wim,xar,z] diff=archive
@SeanSobey
SeanSobey / .gitconfig
Last active November 6, 2017 07:48
Set VSCode as git difftool.
[diff]
tool = vscode
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTE
@SeanSobey
SeanSobey / TimeoutDebug.js
Created November 19, 2017 16:47
Debug node timer leaks
const activeTimeoutIds = new Map();
const _setTimeout = setTimeout;
setTimeout = function (callback, ms, ...args) {
const timeoutId = _setTimeout(() => {
callback();
activeTimeoutIds.delete(timeoutId);
}, ms, ...args);
const stackTrace = (new Error()).stack;
activeTimeoutIds.set(timeoutId, 'ms: ' + ms + ', trace:' + stackTrace);
return timeoutId;
@SeanSobey
SeanSobey / %ProgramFiles(x86)%\Cmder\config\user-profile.ps1
Last active April 24, 2018 08:16
Cmder user profile run default profile.
...
[ScriptBlock]$PostPrompt = {
Update-NavigationHistory $pwd.Path
}
## <Continue to add your own>
# Run profile
@SeanSobey
SeanSobey / .gitconfig
Created January 9, 2018 09:19
Git incoming and outgoing changes aliases
[alias]
outgoing = log --pretty=oneline --abbrev-commit --graph @{u}..
incoming = !git fetch && git log --pretty=oneline --abbrev-commit --graph ..@{u}
@SeanSobey
SeanSobey / .gitconfig
Created March 23, 2018 08:25
Git rename command as alias
[alias]
rename = "!moveit() { branchname=$(git rev-parse --abbrev-ref HEAD); git branch -m $branchname $1; git push origin :$branchname; git push --set-upstream origin $1; }; moveit"
@SeanSobey
SeanSobey / fonts.txt
Last active June 1, 2018 14:58
Coding Fonts
https://github.com/ToxicFrog/Ligaturizer
https://github.com/tonsky/FiraCode
https://github.com/larsenwork/monoid
https://github.com/source-foundry/Hack