Skip to content

Instantly share code, notes, and snippets.

View nurulhudaapon's full-sized avatar

Nurul Huda (Apon) nurulhudaapon

View GitHub Profile
@nurulhudaapon
nurulhudaapon / infra.ts
Created October 3, 2025 12:34
SST Skip Site Builds
new sst.aws.Nextjs('WebAdmin', {
path: 'apps/web-admin',
domain: webAdminDomain,
dev: { autostart: false, command: 'bun nx run web-admin:serve', directory: '.' },
buildCommand: 'exit 0',
environment: {},
skip: $app.stage === 'development',
});
@nurulhudaapon
nurulhudaapon / utils.js
Created August 28, 2023 14:16
bulk-subscribe-voyage-phone
const fs = require('fs/promises');
const path = require('path');
const normalizePhoneNumber = (v) => v && v.length >= 10 && `+1${v.replace(/[^\d]/g, '').slice(-10)}`;
const subscribe = async (phone, campaignId, attributes = {}) => {
const request = {
phoneNumber: normalizePhoneNumber(phone),
campaignId: campaignId,
attributes: attributes,
@nurulhudaapon
nurulhudaapon / phoneFormatter.ts
Created July 14, 2021 05:59
Normalize US Phone Number to E.164 Format
//TypeScript
const normalizePhoneNumber = (v: string): `+1${string}` | null => v && v.length >= 10 && `+1${v.replace(/[^\d]/g, '').slice(-10)}`;
//JavaScript
const normalizePhoneNumber = (v) => v && v.length >= 10 && `+1${v.replace(/[^\d]/g, '').slice(-10)}`;