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 / .gitconfig
Created November 6, 2017 07:43
Set VSCode as git mergetool.
[merge]
tool = vscode
[mergetool "vscode"]
cmd = code --wait $MERGED
@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 / .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 / %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 / 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
@SeanSobey
SeanSobey / .gitconfig
Last active February 24, 2020 12:24
Git sync comnmand as alias
[alias]
sync = "! git fetch && git remote prune origin && git branch --merged | tr -d '* ' | grep -vE '^\\s*master' | xargs -n1 -r git branch -d"
# https://joonro.github.io/blog/posts/powershell-customizations.html
# https://hodgkins.io/ultimate-powershell-prompt-and-git-setup
Import-Module posh-docker
Write-Host "Imported posh-docker"
# https://github.com/dahlbyk/posh-git
Import-Module posh-git
Write-Host "Imported posh-git"