Skip to content

Instantly share code, notes, and snippets.

View kieuvu's full-sized avatar
💯
Focusing

vukm kieuvu

💯
Focusing
View GitHub Profile
import { useState } from './state'
export const useActions = defineStore('repo.actions', () => {
const state = useState()
function alertFoo(): void {
alert(state.foo)
}
function incrementBar(amount = 1) {
@kieuvu
kieuvu / JS_NamePlate.html
Created March 18, 2024 04:24 — forked from najathi/JS_NamePlate.html
Brother Printer BPAC Javascript SDK
<!--
'*************************************************************************
'
' b-PAC 3.2 Component Sample for Extensions (JS_NamePlate.html)
'
' (C)Copyright Brother Industries, Ltd. 2019
'
'*************************************************************************/
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script>
// Obtain UI widgets
const nativePicker = document.querySelector(".nativeDatePicker");
const fallbackPicker = document.querySelector(".fallbackDatePicker");
const fallbackLabel = document.querySelector(".fallbackLabel");
const yearSelect = document.querySelector("#year");
const monthSelect = document.querySelector("#month");
const daySelect = document.querySelector("#day");
@kieuvu
kieuvu / nextjs-deploy.md
Created October 31, 2023 02:33 — forked from jjcodes78/nextjs-deploy.md
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

@kieuvu
kieuvu / index.php
Created October 16, 2023 10:51
Get all dates of month in laravel/carbon
<?php
$startOfMonth = Carbon::now()->startOfMonth();
$endOfMonth = Carbon::now()->endOfMonth();
$instances = CarbonPeriod::create($startOfMonth, $endOfMonth);
$dates = [];
foreach($instances as $instance) {
$dates[] = $instance->toString();
import { NextApiHandler, NextApiRequest } from "next";
import formidable from "formidable";
import path from "path";
import fs from "fs/promises";
export const config = {
api: {
bodyParser: false,
},
};
@kieuvu
kieuvu / debounce.js
Last active November 23, 2023 09:12
import { useState, useEffect } from "react";
const useDebounce = (value, delay) => {
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(() => {
const handler = setTimeout(() => {
setDebouncedValue(value);
}, delay);
@kieuvu
kieuvu / work-with-multiple-github-accounts.md
Created January 31, 2023 04:38 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@kieuvu
kieuvu / cb.cpp
Last active January 30, 2023 10:04
callback in c
#include <cstdio>
void callback(int (*function)(int, int), int a, int b)
{
printf("%d\n", function(a, b));
}
int sum(int a, int b)
{
return a + b;
}
int multiply(int a, int b)
@kieuvu
kieuvu / route.php
Last active January 30, 2023 10:23
Instagram Basic API
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Session;
use GuzzleHttp\Client;
class Instagram
{
private string $clientId;