Skip to content

Instantly share code, notes, and snippets.

View leo6104's full-sized avatar
🎯
Focusing

Heo leo6104

🎯
Focusing
View GitHub Profile
@leo6104
leo6104 / compiler.Dockerfile
Last active May 24, 2023 23:25
aws-lambda-poppler-layer 23.05.0 version
FROM amazonlinux:2018.03
SHELL ["/bin/bash", "-c"]
ENV BUILD_DIR="/tmp/build"
ENV INSTALL_DIR="/opt"
# Lock To Proper Release
RUN sed -i 's/releasever=latest/releaserver=2018.03/' /etc/yum.conf
@leo6104
leo6104 / translate.pipe.ts
Last active May 16, 2024 07:30
Angular Translate library with Signal API (for optimized rendering performance)
import {
computed,
effect,
Inject,
Injectable,
Pipe,
PipeTransform,
PLATFORM_ID,
signal,
SkipSelf
@leo6104
leo6104 / hydration-util.ts
Created April 20, 2023 03:28
Hydration unit test code in angular 16 (with custom util)
import {
ApplicationRef,
ComponentRef,
destroyPlatform,
getPlatform,
Provider,
Type,
ɵsetDocument
} from '@angular/core';
import {
@leo6104
leo6104 / sheet-detail.html
Created April 19, 2023 17:25
angular/angular issue 49929 reproduction markup
<ng-container *ngIf="{
status: status$ | async,
sheetId: sheetId$ | async,
currentUser: currentUser$ | async,
isPurchased: isPurchased$ | async,
isReviewed: isReviewed$ | async,
reviewStatus: reviewStatus$ | async,
sidebarIsSticky: sidebarSticky$ | async
} as d">
<scroll-to-top [trackBy]="d.sheetId"></scroll-to-top>
@leo6104
leo6104 / music-xml-transpose.ts
Last active February 3, 2021 16:14
MusicXML Transpose (Typescript)
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 April 25, 2018 19:00
levenshtein distance (Edit distance) algorithm in typescript
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 December 21, 2021 00:05
Convert .angular-cli.json to angular.json (for Angular 6 Migration from Angular 2/4/5)
/**
* 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');