Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Heo leo6104

🎯
Focusing
View GitHub Profile
@leo6104
leo6104 / music-xml-transpose.ts
Last active Feb 3, 2021
MusicXML Transpose (Typescript)
View music-xml-transpose.ts
const main = () => {
const transposer = new MusicXmlTransposeService();
transposer.load(this.xmlPath).then(() => {
transposer.transpose('E');
// use transposer.xml variable (In my case, call `osmd.load(transposer.xml);`)
});
};
// Thanks to @ice6 @AlbertHart
// Inspired from https://github.com/opensheetmusicdisplay/opensheetmusicdisplay/commit/467e0a600d168e59c6376bc9c75f553801c98961#diff-19b11c7ef440f126313c8af1217075c7L122
@leo6104
leo6104 / levenshtein.ts
Created Apr 25, 2018
levenshtein distance (Edit distance) algorithm in typescript
View levenshtein.ts
function levenshtein(a: string, b: string): number {
if (a.length == 0) {
return b.length;
}
if (b.length == 0) {
return a.length;
}
const matrix = new Array<number[]>(b.length + 1);
for (let i = 0; i <= b.length; i++) {
matrix[i] = new Array<number>(a.length + 1);
@leo6104
leo6104 / ng-update-v6.js
Last active Aug 5, 2021
Convert .angular-cli.json to angular.json (for Angular 6 Migration from Angular 2/4/5)
View ng-update-v6.js
/**
* Created by leo6104 (github.com/leo6104)
* You can use this nodejs script on angular v5/v4/v2 project.
* 1. Place this gist file `ng-update-v6.js` to angular project's root path
* 2. use command `node ng-update-v6.js .angular-cli.json`
* 3. check angular.json file (created by ng-update-v6.js)
**/
const fs = require('fs');
const path = require('path');