Skip to content

Instantly share code, notes, and snippets.

@davedele
davedele / us_all.json
Last active March 22, 2025 12:16
us_all.json
{
"locations": [
{
"name": "Alabama",
"slug": "alabama",
"description": "",
"meta": [
{
"image_id": 0
},
@davedele
davedele / bc.txt
Last active October 9, 2023 22:29
b1
createHorzChart(): void {
const options: ApexCharts.ApexOptions = {
chart: { id: this.chartUID || null, type: 'bar', height: 350 },
series: [
{
name: this.seriesName,
data: this.data?.map((item) => item?.value),
label: this.data?.map((item) => item?.label)
}
],
@davedele
davedele / formatEmailForReceipt
Created June 19, 2023 06:38
function that uses regular expressions to split the email address at logical breakpoints (i.e., before a . or after a @). It then creates a string with HTML line breaks (<br>) where the email was split. This function assumes a maximum line length of 40 characters, which is typical for point-of-sale receipt printers.:
// The standard width of a typical receipt paper is 80mm, print density is about 40-48 characters per line depending on font size.
// function that uses regular expressions to split the email address at logical breakpoints (i.e., before a . or after a @, etc.).
// It then creates a string with HTML line breaks (<br>) where the email was split. This function assumes a maximum line length of 40 characters, which is typical for point-of-sale receipt printers.:
function formatEmailForReceipt(email: string): string {
const MAX_LINE_LENGTH: number = 40;
const MIN_BREAKPOINT_LENGTH: number = 10; // The minimum length before a breakpoint to consider breaking
let lines: string[] = [];
let currentLine: string = "";