Skip to content

Instantly share code, notes, and snippets.

View trandaison's full-sized avatar

Son Tran trandaison

View GitHub Profile
@trandaison
trandaison / Preview.md
Last active July 2, 2023 02:45
LINE Loading icon SVG

Loading icons are a recommended UI element in LINE MINI App

<script lang="ts" setup>
import { useAsyncCookie } from '~/composables/useAsyncCookie';
const expires = new Date();
expires.setSeconds(5);
const testCookie = useAsyncCookie('test', { maxAge: 5 });
testCookie.value = 'sometext';
const c = useCookie('xxtest', { maxAge: 5 });
@trandaison
trandaison / vue-script.code-snippets
Last active May 18, 2023 10:00
Some Vue Snippets
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
@trandaison
trandaison / AppLink.vue
Created April 28, 2023 02:55
Re-create page component when click on same page router link in Vue/Nuxt
@trandaison
trandaison / hexstring.js
Created September 5, 2022 10:31 — forked from tauzen/hexstring.js
Hex string to byte and other way round conversion functions.
function byteToHexString(uint8arr) {
if (!uint8arr) {
return '';
}
var hexStr = '';
for (var i = 0; i < uint8arr.length; i++) {
var hex = (uint8arr[i] & 0xff).toString(16);
hex = (hex.length === 1) ? '0' + hex : hex;
hexStr += hex;
@trandaison
trandaison / check_ports.md
Created January 13, 2022 12:03
Setup New FE Server on EC2 (PM2)

How to check if port is in use in

sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo ss -tulpn | grep LISTEN
sudo lsof -i:22 ## see a specific port such as 22 ##
sudo nmap -sTU -O IP-address-Here
@trandaison
trandaison / redis_mac.md
Created May 17, 2021 01:28
Install Redis on MacOS

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@trandaison
trandaison / pm2.md
Created May 17, 2021 01:26
PM2 deployment

1. Preparing the server

Install git

sudo apt install git-all

Generate Server's SSH public key

ssh-keygen -t rsa -b 4096 -C "deploy"
cat ~/.ssh/id_rsa.pub
@trandaison
trandaison / pm2.md
Last active February 26, 2021 07:56
PM2 Guide

Chuẩn bị server

Cài đặt git

sudo apt install git-all

Generate SSH key để phục vụ deploy

ssh-keygen -t rsa -b 4096 -C "server.ip"
@trandaison
trandaison / cw-dark-mode.vue
Last active September 25, 2019 04:52
Chatwork dark mode
<template>
<div class="toggle-dark-theme">
Dark theme
<label class="switch">
<input type="checkbox" checked id="toggle-dark-theme">
<span class="slider round"></span>
</label>
</div>
</template>