Skip to content

Instantly share code, notes, and snippets.

View muchrm's full-sized avatar
😃

Pongpanot Chuaysakun muchrm

😃
  • LINE THAILAND
  • Thailand
  • 10:54 (UTC +07:00)
View GitHub Profile
@muchrm
muchrm / ngrx8_with_immer.ts
Created October 22, 2019 04:30 — forked from born2net/ngrx8_with_immer.ts
ngrx 8+ with immer and support for on() within reducer
import {createReducer} from '@ngrx/store';
import {on} from "@ngrx/store";
import produce, {Draft} from "immer";
export const initialUserState: IUserState = {
knownUsers: [user1, user2],
selectedUser: null,
scenes: null
};
@muchrm
muchrm / introrx.md
Created October 8, 2019 05:31 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@muchrm
muchrm / same-effect-multiple-actions.ts
Created October 1, 2019 11:29 — forked from praveenpuglia/same-effect-multiple-actions.ts
Same effect for multiple actions - ngrx effects
@Effect({dispatch: false})
entityCreationSuccess$: Observable<Action> = this.actions$.pipe(
ofType(UserActions.CREATE_USER_SUCCESS, PostActions.CREATE_POST_SUCCESS),
tap(action => {
this.router.navigate(['../'], {relativeTo: this.route})
})
);
@muchrm
muchrm / profiles.json
Created September 25, 2019 04:09 — forked from kasuken/profiles.json
Windows Terminal settings and files
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{
provider "aws" {
version = "~> 2.0"
region = "ap-southeast-1"
shared_credentials_file = "~/.aws/credentials"
}
resource "aws_lightsail_static_ip_attachment" "drone-ci" {
static_ip_name = "${aws_lightsail_static_ip.drone-ci-ip.name}"
instance_name = "${aws_lightsail_instance.drone-ci.name}"
}
{
"captionColor":"white",
"captionSize":100,
"backgroundCaptionColor":"black",
"backgroundCaptionTransparent":50,
"captionPosition":"bottom",
"captionStatus":true
}
import * as PDF from 'html-pdf';
import * as fs from 'fs';
import * as mustache from 'mustache';
async createPdf(teacherId, year, res) {
const report = await this.getByTeacher(teacherId, year);
const teacher = await this.personService.findByObjectId(teacherId);
const major = await this.majorService.getByTeacher(teacherId);
let majorName = major.name;
if (major){
#!/bin/bash
DATE=`date +%Y.%m.%d`
FILENAME="db.$DATE"
BACKUP_FOLDER="backup"
MAXFILE=4
if [ ! -d "$BACKUP_FOLDER" ]; then
mkdir -p $BACKUP_FOLDER
fi
cd $BACKUP_FOLDER
SELECT
Person.personId,
Person.personCode,
Person.fName,
Person.lName,
PersonT.fName2,
PersonT.lName2,
PersonT.birthDate,
rs_academic_position.acp_name_th,
PersonT.emailAddr AS email,
(defn print-dot [n]
(loop [i n]
(when (> i 0)
(print "*")
(recur (- i 1)))))
(defn print-space [n]
(loop [i n]
(when (> i 0)
(print " ")