Skip to content

Instantly share code, notes, and snippets.

View ericjeker's full-sized avatar
👋

Eric Jeker ericjeker

👋
View GitHub Profile
@ericjeker
ericjeker / set_prompt.sh
Created April 16, 2024 00:58
Set PS1 to a clean prompt
PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;34m\]\w\[\033[00m\]\[\033[01;32m\]\$(__git_ps1 \" (%s)\")\[\033[01;35m\] \$\[\033[00m\] "
@ericjeker
ericjeker / blue-eye.frag
Last active October 24, 2022 10:23
Animated Shader Eye
// Author:
// Title:
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.1415
uniform vec2 u_resolution;
@ericjeker
ericjeker / 3commas.helper.js
Created November 29, 2021 10:16
3Commas Helpers for generating a Signature and flatten a JSON body
/**
* Create a proper 3Commas signature (HMACSHA256)
*
* @param str string
* @param secret string
* @return {string}
*/
export function sign(str, secret) {
return crypto.createHmac('sha256', secret).update(str).digest('hex');
}
@ericjeker
ericjeker / class-serializer.interceptor.ts
Last active November 4, 2022 20:49
Partial rewrite of Nest.js ClassSerializerInterceptor to integrate the findAndCount result of TypeORM and serialize the results using class-transformer
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import {
CallHandler,
ExecutionContext,
Inject,
Injectable,
NestInterceptor,
Optional,
} from '@nestjs/common';
@ericjeker
ericjeker / page-carded.component.scss
Created March 13, 2020 06:50
Scoped SCSS in Angular
app-page-carded {
h1 {
font-size: $big;
}
}
@ericjeker
ericjeker / articles.component.html
Created March 13, 2020 06:47
Full example of a customizable component using TemplateRef and ContentChild in Angular
<div id="articles-list">
<!-- Our page carded component -->
<app-page-carded>
<ng-template #title>
<h1>Users List</h1>
</ng-template>
<ng-template #search>
<!-- Display a search box -->
<app-list-search [listForm]="listForm"></app-list-search>
<!-- Display a modal form containing our filters -->
@ericjeker
ericjeker / content-child.component.ts
Created March 13, 2020 06:42
TemplateRef and ngTemplateOutlet using ContentChild in Angular
@Component({
selector: 'app-my-content',
template: '<ng-container *ngTemplateOutlet="tplRef"></ng-container>',
})
class MyContent {
@ContentChild('myContent', {static: true}) tplRef: TemplateRef<any>;
}
@ericjeker
ericjeker / parent.component.html
Last active March 13, 2020 06:38
Simple TemplateRef and ngTemplateOutlet usage in Angular
<app-my-content tplRef="myContent"></app-my-content>
<ng-template #myContent>
<app-my-other-component>Hello world!</app-my-other-component>
</ng-template>
@ericjeker
ericjeker / memory-leak.component.html
Created March 13, 2020 06:35
Memory leak with content projection and sub-component in Angular
<app-my-content>
<app-my-other-component>This will cause a memory leak!</app-my-other-component>
</app-my-content>
@ericjeker
ericjeker / content-projection.component.ts
Last active March 13, 2020 06:39
Content projection in Angular
@Component({
selector: 'app-my-content',
template: '<ng-content></ng-content>',
})
class MyContent {
}