Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
.

Mario Binder MarioBinder

:octocat:
.
View GitHub Profile
@MarioBinder
MarioBinder / levenshtein.ts
Created August 8, 2022 06:01
levenshtein.ts
View levenshtein.ts
export function levenshtein(a: string, b: string): number {
if (!a.length) {
return b.length;
}
/* c8 ignore next 3 */
if (!b.length) {
return a.length;
}
@MarioBinder
MarioBinder / compareFolders.ps1
Created June 9, 2022 14:38
compare to folders (with manipulatings foldernames)
View compareFolders.ps1
$Folder1 = Get-ChildItem -Name "D:\Gitserver\Repositories" | foreach {$_.ToLower() + ".git"}
$Folder2 = Get-childitem -Name "D:\Gitea\Repositories\wdmm" | foreach {$_.ToLower() }
Compare-Object $Folder1 $Folder2
@MarioBinder
MarioBinder / 1.readme.md
Last active March 14, 2022 17:18
open sublime links from webpage
View 1.readme.md

sublime-protocol-win

Setting up Custom URI scheme handler for Windows to open files in Sublime editor
Created to parse URI's generated by filp/whoops
Parsing is done with VBScript, as that was the only way I found to open Sublime editor, while avoiding annoying command prompt window to pop up and close.

NOTE

After downloading / cloning the repository, you have to edit files to update path to open_file.vbs and to add path to Sublime editor
Currently I don't have time to create install/uninstall scripts, so any help is welcome
Also, README.md is all upside-down, so that will be updated soon

@MarioBinder
MarioBinder / enableOleAutomation.sql
Last active February 24, 2022 12:14 — forked from JahsonKim/enableOleAutomation.sql
How to send http POST request from sql server stored procesdure.
View enableOleAutomation.sql
--This query enables ole automation procedures. set 0 to disable
exec master.dbo.sp_configure 'Ole Automation Procedures', 1
RECONFIGURE
--OLE automation disabled the following error is thrown.
--SQL Server blocked access to procedure 'sys.sp_OACreate' of component
--'Ole Automation Procedures' because this component is turned off as part
--of the security configuration for this server.
--A system administrator can enable the use of 'Ole Automation Procedures'
@MarioBinder
MarioBinder / tools.bat
Created November 19, 2021 15:11
faster delete folder in windows
View tools.bat
rmdir /s/q foldername
@MarioBinder
MarioBinder / tools.bat
Last active January 3, 2022 13:17
command line -> cd unc / network folders
View tools.bat
create a temp virtual drive: pushd "\\172.29.0.30\"
delete the virtual drive: popd "\\172.29.0.30\"
@MarioBinder
MarioBinder / jquery.js
Created October 29, 2021 12:44
load jquery in console
View jquery.js
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type (or see below for non wait option)
jQuery.noConflict();
//https://stackoverflow.com/a/7474386/119109
@MarioBinder
MarioBinder / script.sql
Created October 29, 2021 09:32
SQL measure IO and time for query
View script.sql
SET STATISTICS IO, TIME ON
@MarioBinder
MarioBinder / Program.cs
Created October 29, 2021 08:59
PriorityQueue Example
View Program.cs
var tvShows = new PriorityQueue<string, ShowRating>();
tvShows.Enqueue("Modern Family", ShowRating.Good);
tvShows.Enqueue("Ted Lasso", ShowRating.Amazing);
tvShows.Enqueue("MasterChef", ShowRating.Good);
tvShows.Enqueue("Breaking Bad", ShowRating.Transcendant);
tvShows.Enqueue("Happy Endings", ShowRating.Amazing);
tvShows.Enqueue("Game of Thrones (Seasons 1-6)", ShowRating.Amazing);
tvShows.Enqueue("Game of Thrones (Seasons 7-8)", ShowRating.OK);
tvShows.Enqueue("How to Get Away with Murder", ShowRating.Good);
@MarioBinder
MarioBinder / gist:6550a30a026d30a09890b3edd5df1a32
Last active July 19, 2021 06:33
stash current work into new branch #git #stash #branch
View gist:6550a30a026d30a09890b3edd5df1a32
git stash
git stash branch <new-branch> stash@{0}
If the other branch already exists, you can just switch to it with checkout, then git stash apply
//via https://stackoverflow.com/a/30927991/119109