Skip to content

Instantly share code, notes, and snippets.

View lakpahana's full-sized avatar

AGS Lakpahana lakpahana

View GitHub Profile
@lakpahana
lakpahana / shopify-webhook-create-order.json
Last active March 30, 2026 11:47
shopify-webhook-create-order
{
"id": 7321467126073,
"admin_graphql_api_id": "gid:\/\/shopify\/Order\/7321467126073",
"app_id": 580111,
"browser_ip": "2402:d000:8120:1edb:5560:b29a:5874:e5dd",
"buyer_accepts_marketing": false,
"cancel_reason": null,
"cancelled_at": null,
"cart_token": "hWNARYdKTu7ec6rfO9Z6wnib",
"checkout_token": "f868bf60039b872ec13e79d488feb130",
User: You are a senior TypeScript engineer tasked with refactoring legacy JavaScript code.
The file `legacy.js` contains an existing function named `countByRole`. Your goal is to refactor this function to improve **readability, maintainability, and type safety** while preserving its exact behavior.
### Requirements
1. **Do not change functionality** — the refactored version must produce identical results.
2. Convert the implementation to **TypeScript**.
3. Add appropriate **TypeScript types**, including:
@lakpahana
lakpahana / howto.txt
Created January 12, 2026 17:34
uni proxy mac
source proxy_zsh.zsh on
source proxy_zsh.zsh off
#!/usr/bin/python3
"""
created by :
Nityananda Gohain
School of Engineering, Tezpur University
27/10/17
"""
@lakpahana
lakpahana / alive.txt
Created February 22, 2024 16:30
200 REASONS YOU NEED TO STAY ALIVE!
saw this in a utube comment.
reasons to stay alive 🤍
1. your family
2. your friends
3. the feeling you get when you’ve finished something
@lakpahana
lakpahana / gist:28ffe7f6515736c1c18a4c2353d1d973
Created August 19, 2023 05:39
CVV add slash and validation
function formatString(e) {
var inputChar = String.fromCharCode(event.keyCode);
var code = event.keyCode;
var allowedKeys = [8];
if (allowedKeys.indexOf(code) !== -1) {
return;
}
event.target.value = event.target.value.replace(
/^([1-9]\/|[2-9])$/g, '0$1/' // 3 > 03/
@lakpahana
lakpahana / gist:518767ae0496a6ca316ff9d9775c8c72
Created August 3, 2023 03:57
How To Read A STRING Line In C++
#include <string>
#include <sstream>
string line;
getline(cin, line);
istringstream iss(line);
string word;
while (iss >> word)
{
In case you cannot download node packages using uni wifi.
Open cmd and run following two commands.
npm config set https-proxy http://10.50.225.222:3128
npm config set proxy http://10.50.225.222:3128
When you switch back to your private connection. Run following two commands.
npm config delete proxy
npm config delete https-proxy
using System;
using System.IO;
namespace ConsoleApp4
{
class MyClassCS
{
static void Main()
{
using var watcher = new FileSystemWatcher(@"C:\xampp\htdocs\FileSystemWatcher");