Skip to content

Instantly share code, notes, and snippets.

View balazsorban44's full-sized avatar
🌍
Coding from anywhere

Balázs Orbán balazsorban44

🌍
Coding from anywhere
View GitHub Profile
@balazsorban44
balazsorban44 / gist:52c2858aa10f6269c7a9b3c0cfa247d5
Created September 6, 2017 07:39
Firebase sample code for question on Stack Overflow
Database:
"root": {
"reservations": {
"-59a9ac14cf84dddb10852e65": {
"details": {
"message": "in labore velit quis commodo.",
"children": 0,
"adults": 5,
"tel": "+36-96-055-6277",
"email": "consequat@ipsum.com",
@balazsorban44
balazsorban44 / machine.js
Created November 1, 2019 11:18
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@balazsorban44
balazsorban44 / block-content-to-react.d.ts
Created April 26, 2020 08:57
Add this to @types/@sanity folder in the root of your TS project.
declare module "@sanity/block-content-to-react"
{
import * as React from "react"
export interface BlockContentProps {
/**
* Pass in either an array or a single object of [Portable Text](https://github.com/portabletext/portabletext)
*
* *This is the only required prop*
*/
@balazsorban44
balazsorban44 / useEventualScroll.ts
Created May 13, 2020 20:26
Scrolls to an element after that element is added to the DOM
import * as React from "react"
/** Scrolls to an element after that element is added to the DOM */
const useEventualScroll = (
/**
* Holds the element to scroll to.
* The closer it is to that element, the less Mutations are observed
* by MutationObserver. If not defined, document will be used.
*/
container?: null | HTMLElement
function profile(profile) {
return ({
...profile,
id: profile.sub,
name: profile["http://domain.com/Events/Customer/Fullname"] ?? profile["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"],
verified: profile["email_verified"] === "True",
})
}
// I wish this file to be generated from my *.gql files
declare module '*/queries.gql' {
export const Something: string;
export const SomethingElse: string;
}
import fs from "fs"
import path from "path"
import chalk from "chalk"
const getDirectories = (source ) => {
const dirents = fs.readdirSync(source, { withFileTypes: true })
return dirents
.filter(
(dirent) =>
import NodeCache from "node-cache"
const cache = new NodeCache()
/**
* Retrieves an access_token from an OAuth Provider for building purposes,
* using client_credentials (client secret) authorization type.
*/
export default async function getBuildToken(){
try {
az aks get-credentials --resource-group k8s-demo-ss --name k8s-demo-cluster-ss --file kubeconfig-ss
@balazsorban44
balazsorban44 / logger.ts
Last active July 21, 2021 12:29
Next.js API route that parses minified stacks and sends it to third-party logger.
import { NextApiRequest, NextApiResponse } from "next"
import log, { LogLevel } from "utils/server-logger"
import StackTraceGPS from "stacktrace-gps"
import ErrorStackParser from "error-stack-parser"
import fs from "fs"
import path from "path"
export default async function logger(
req: NextApiRequest,
res: NextApiResponse