Skip to content

Instantly share code, notes, and snippets.

Get-CimInstance Win32_Process -Filter "Name = 'chrome.exe' AND CommandLine LIKE '%--headless%'" | %{Stop-Process $_.ProcessId}
@Dobby89
Dobby89 / getClosest.js
Last active March 30, 2020 08:19
Find the closest element to the target element
/**
* getClosest
*
* Find the closest element to the target element
*
* @param target - dom element which is the current element
* @param selector - the element you are looking for
* @param scope - limit the search to a containing element
* @returns {*}
*/
@Dobby89
Dobby89 / npm-list
Created January 14, 2019 14:26
List all global NPM packages/modules
npm list -g --depth 0
@Dobby89
Dobby89 / Powershell Profile.md
Last active October 26, 2018 07:46
Set alias commands in powershell

Full docs

1) Open Powershell in administrator

2a) Make sure you have a profile created (where you can save your aliases)

PS> New-Item -Type file -Force $profile

2b) Check where the profile has been created

@Dobby89
Dobby89 / delete-directories-recursively.bat
Created September 26, 2018 07:19
Delete all directories recursively, from the current directory
FOR /d /r . %d in (DIR_NAME_HERE) DO @IF EXIST "%d" echo %d && RMDIR /S /Q %d"
@Dobby89
Dobby89 / cloudSettings
Last active March 19, 2020 08:17
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-03-18T16:06:51.760Z","extensionVersion":"v3.4.3"}
@Dobby89
Dobby89 / rInterval.js
Last active July 9, 2018 10:42
More accurate/consistent interval using requestAnimationFrame
/**
* A more consistent interval than the native setInterval.
* Should help prevent the time drifting.
*
* @param {function} callback
* @param {integer} delay
*/
const rInterval = function (callback, delay) {
let requestAnimation = window.requestAnimationFrame;
let start = Date.now();
@Dobby89
Dobby89 / node-gyp.md
Created June 13, 2018 07:11
How to install node-gyp on Windows
@Dobby89
Dobby89 / partiallyApply.js
Last active July 5, 2018 12:21
Apply an initial set of params to a method. Similar to bind() but without having to pass `this`
/**
* partiallyApply
*
* Apply an initial set of params to a method.
* Similar to bind() but without having to pass `this`
*
* @param {function} fn
* @param {*} initialArgs
*/
function partiallyApply(fn, ...initialArgs) {