Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / npm-list
Created January 14, 2019 14:26
List all global NPM packages/modules
npm list -g --depth 0
@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 {*}
*/
Get-CimInstance Win32_Process -Filter "Name = 'chrome.exe' AND CommandLine LIKE '%--headless%'" | %{Stop-Process $_.ProcessId}
@Dobby89
Dobby89 / Multiple css files
Created May 16, 2019 13:46
Multiple css files in webpack
https://stackoverflow.com/questions/50976979/output-2-or-more-css-files-with-mini-css-extract-plugin-in-webpack
@Dobby89
Dobby89 / search.exclude
Created June 5, 2019 06:40
VS Code exlude patterns. Configured from within settings
**/node_modules
**/bower_components
./public
./coverage
@Dobby89
Dobby89 / mercurial-commands.sh
Created August 21, 2019 14:19
Useful Mercurial commands
Tell Mercurial you're renaming (not deleting) a file so it keeps the history
If you've already moved/renamed the file:
$ hg rename --after old-file.txt new-file.tx
$ hg rename --after olddir newdir
If you'd like Mercurial to rename the file for you
$ hg rename old-file.txt new-file.tx
$ hg rename olddir newdir
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)){ return; }
js = d.createElement(s); js.id = id;
js.onload = function(){
// remote script has loaded
};
js.src = "//domain.com/index.js";
fjs.parentNode.insertBefore(js, fjs);