Skip to content

Instantly share code, notes, and snippets.

View 03balogun's full-sized avatar

Balogun Wahab 03balogun

View GitHub Profile
// app/api/report/route.ts
import {ErrorReport, Report} from "@/components/reports/Report"; // Import components
export async function GET(req: NextRequest) {
const response = await makeAPIRequestToTheBackend()
const component = response?.status
? Report({record: response?.data})
// components/reports/Report.tsx
import {Document, Page, Font} from "@react-pdf/renderer";
import {PImage, PLink, PText, PView} from "@/components/pdf-ui";
Font.register({
family: "Work Sans",
fonts: [
{
@03balogun
03balogun / react-pdf-tailwind-primitives.tsx
Created November 18, 2024 12:07
react-pdf-tailwind-primitives.tsx
import {createTw} from "react-pdf-tailwind";
import {Image, Link, Text, View} from "@react-pdf/renderer";
import {ComponentProps} from "react";
import {Style, SVGPresentationAttributes} from "@react-pdf/types";
type PropsWithClassName<T> = T & {className?: string}
const mergeStyles = (...styles: (Style | Style[] | SVGPresentationAttributes | undefined)[]) => {
const merged: Style = {};
import { AppNavHookType } from '@navigation/navigators'
import { useNavigation } from '@react-navigation/native'
/**
* AnimatedBox, Box, Text, TextInput
* These UI components are extensions of styled-components + custom styles
* e.g
* export const Box = styled.View<BoxProps>``
* export const Text = styled.Text<TextProps>``
* export const AnimatedBox = Reanimated.createAnimatedComponent(Box)
@03balogun
03balogun / nigerian-banks.json
Last active August 7, 2025 05:56
JSON List of Nigerian Banks and Codes
{
"data": [
{
"name": "9mobile 9Payment Service Bank",
"code": "120001"
},
{
"name": "Abbey Mortgage Bank",
"code": "404"
},
@03balogun
03balogun / copy_redis_key.sh
Created June 3, 2022 18:09 — forked from ZwodahS/copy_redis_key.sh
copy a redis db key to another place (use MIGRATE COPY for v3.0<= redis)
#!/bin/bash
# source http://stackoverflow.com/questions/23222616/copy-all-keys-from-one-db-to-another-in-redis
#set connection data accordingly
source_host=localhost
source_port=6379
source_db=1
target_host=localhost
target_port=6379
target_db=2
<?php
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
<?php
...
// custom/modules/AOS_PDF_Templates/generatePdfSendMail.php
if ($task == 'pdf' || $task == 'emailpdf') {
$file_name = $mod_strings['LBL_PDF_NAME'] . "_" . str_replace(" ", "_", $bean->name) . ".pdf";
ob_clean();
try {
$orientation = ($template->orientation == "Landscape") ? "-L" : "";
<?php
// custom/include/MVC/Controller/entry_point_registry.php
$entry_point_registry['generatePdfSendMail'] = array(
'file' => 'custom/modules/AOS_PDF_Templates/generatePdfSendMail.php',
'auth' => '0'
);