Skip to content

Instantly share code, notes, and snippets.

View ozkary's full-sized avatar
🎯
Focusing on the next reality to come

Oscar D. Garcia ozkary

🎯
Focusing on the next reality to come
View GitHub Profile
@ozkary
ozkary / App-Declarative-Routes.tsx
Last active March 17, 2023 15:21
React Routing with Suspense approach to avoid re-rendering of child components. - See https://www.ozkary.com/2023/02/react-suspense-fallback-keeps-rendering.html
/*
Lazy loading component with Suspense support
*/
import React, { Suspense } from 'react';
import Loading from './Loading';
const App = (): JSX.Element => {
// lazy load the containers. This should create different chunk file
@ozkary
ozkary / helloworld.cpp
Last active May 1, 2022 19:19
A simple hello world application using standard output.
/*
* Copyright 2022 ozkary.com
* http://ozkary.com/ by Oscar Garcia
* Licensed under the MIT license. Please see LICENSE for more information.
*
* helloworld.cpp
* Simple Console standard output and input string
* ver. 1.0.0
*
* Created By oscar garcia - ozkary
@ozkary
ozkary / fluid-for-loop.xml
Last active March 22, 2022 20:08
APIM Fluid Scripts . These are policy transformation scripts. Use them to transform XML, JSON documents into JSON documents to match your platform requirements,
/*
@file fluid-for-loop.xml
@description Use this script to convert an input array into json properties. Notice how a command is not added to the last item.
Use hyphen to strip extra blank chrs.
@author ogarcia (ozkary)
@ref https://shopify.dev/api/liquid/objects/for-loops
Input JSON request:
{
"names": [
@ozkary
ozkary / staticwepapps.config.json
Created February 26, 2022 01:14
Static Web Apps configuration to handle HTTP 404 errors with a fallback policy
{
"routes": [
{
"route": "/",
"allowedRoles": ["anonymous"]
},
{
"route": "/about",
"allowedRoles": ["anonymous"]
},
@ozkary
ozkary / brand-a.yml
Last active March 22, 2022 14:45
Branding Apps with GitHub Actions
name: Ozkary Brand A CI/CD
on:
push:
branches:
- brand-a
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- brand-a
@ozkary
ozkary / routeLoader.ts
Last active March 22, 2022 14:44
Route loader when using lazy loading and dynamic imports to manage ChunkLoadErrors
/**
* @file routes/routeLoader.ts
* @description lazy loading of routes.
*
* @author ogarcia (ozkary)
*
*/
/**
* Use this route loader when using lazy loading and dynamic imports
@ozkary
ozkary / continent-names.xml
Last active October 22, 2021 16:04
API Management transforms a SOAP API into JSON API
<policies>
<inbound>
<base />
<rewrite-uri template="/websamples.countryinfo/CountryInfoService.wso" copy-unmatched-params="false" />
<set-body template="liquid">
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns="http://www.oorsprong.org/websamples.countryinfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ListOfContinentsByName>
</ListOfContinentsByName>
</soap:Body>
@ozkary
ozkary / logger-component-error.ts
Last active March 22, 2022 14:39
AppInsights React Logger Service
// import the operations from logger
import { error, audit } from '../logger';
/**
* Sample code to log an error from a handled exception
* send the message asychronously
*/
try {
// call an operation that can raise errors
@ozkary
ozkary / Azure-static-web-app-cli
Last active March 22, 2022 14:38
CLI Script to create Azure Static Wep App Resource
#!/bin/bash
#
# Purpose: Use the bash file to automate the creation of an Azure Static Web App with CICD Github Pipeline
# Requirements: Azure subscription, Github branch and repo token
# Author: 0garcia - ozkary
# Article: https://www.ozkary.com/2021/02/azure-static-web-app-github-actions-cicd.html
#
clear
# creates the azure resources for a static web app with github cicd pipeline
/*
Filename: azure-sql-read-only-user.sql
Purpose: Create a read-only login user on a target database to enable the access to the data, but disable any insert, update, delete operations.
Author:
Oscar Garcia @ozkary
Reference: