Skip to content

Instantly share code, notes, and snippets.

View vunguyentuan's full-sized avatar

Vu Nguyen vunguyentuan

View GitHub Profile
{
"basics": {
"name": "Vu Nguyen",
"label": "Senior Full-stack Engineer",
"image": "",
"email": "tuanvu.vn007@gmail.com",
"phone": "+84 393768750",
"summary": "A results-driven Senior Full-stack Engineer with over 10 years of experience in designing, building, and optimizing responsive web applications. Skilled in leading cross-functional teams, mentoring developers, and implementing scalable architectures. Proven expertise in React, Node.js, AWS, and cloud-based solutions. Passionate about driving technical excellence, improving team productivity, and delivering high-performance applications.",
"location": {
"address": "",
{
"basics": {
"name": "Thomas Edison",
"label": "Inventor and Businessman",
"picture": "https://example.com/photo.jpg",
"email": "thomas.edison@example.com",
"phone": "(123) 456-7890",
"website": "https://thomasedison.com",
"summary": "Prolific inventor and businessman known for developing many devices that greatly influenced life around the world, including the phonograph, the motion picture camera, and the electric light bulb.",
"location": {
{
"basics": {
"name": "Thomas Edison",
"label": "Inventor and Businessman",
"picture": "https://example.com/photo.jpg",
"email": "thomas.edison@example.com",
"phone": "(123) 456-7890",
"website": "https://thomasedison.com",
"summary": "Prolific inventor and businessman known for developing many devices that greatly influenced life around the world, including the phonograph, the motion picture camera, and the electric light bulb.",
"location": {
import { Button } from "components/ui/button";
import { useState } from "react";
import { z } from "zod";
const FormSchema = z.object({
name: z.string().min(1, "Name is required"),
email: z.string().email().min(1, "Email is required"),
});
type FormState = {
@vunguyentuan
vunguyentuan / scheduleNotification.ts
Created December 28, 2021 15:14
Create cloud tasks to send notification
const pages = []
const batchSize = 2000;
let currentIndex = 0;
while (currentIndex < totalUsers) {
pages.push({ fromIndex: currentIndex, toIndex: currentIndex + batchSize });
currentIndex += batchSize;
}
await PromisePool.for(pages)
.withConcurrency(10)
.process(async (page) => {
@vunguyentuan
vunguyentuan / sendNotification.ts
Created December 28, 2021 15:07
Firebase batch send notification
export const sendNotifications = functions
.runWith({
timeoutSeconds: 540,
memory: '1GB',
})
.https.onRequest(async (req, res): Promise<void> => {
const { fromIndex, toIndex } = req.body;
const usersDataResponse = await db.users.orderBy('userIndex').startAt(fromIndex).endAt(toIndex).get();
const userToSendNotifications = usersDataResponse.docs.filter(onlyUserAtTimezone)
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@vunguyentuan
vunguyentuan / machine.js
Created October 18, 2020 12:05
Generated by XState Viz: https://xstate.js.org/viz
const taskMachine = Machine({
id: 'toggle',
initial: 'todo',
context: {
deleted: false,
},
states: {
todo: {
export function getVideoSourceByBrowser(sources) {
const isTaiwan =
getCookiesItem('foxplus_default_locale') &&
getCookiesItem('foxplus_default_locale').country === 'tw'
if (isChrome() || isFirefox()) {
const isTaiwanSource = [
'SCM Clean Mandarin Dash WM',
'Clean Mandarin Dash WM',
'Burnt-In Mandarin Dash WM'
@vunguyentuan
vunguyentuan / 00_nginx.config
Created April 20, 2018 08:16 — forked from devops-1/00_nginx.config
00_nginx.config
container_commands:
01-nginx:
command: /opt/elasticbeanstalk/hooks/configdeploy/enact/35_nginx.sh
files:
"/home/ec2-user/nginx.conf":
mode: "000644"
owner: root
group: root
content : |