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 / Istanbul Code Coverage Gruvbox theme
Last active September 9, 2021 09:11
Using Stylus, I made this Gruvbox "like" dark theme for my Istanbul code coverage. UNFINISHED. Please leave a comment, if you add something to it, or if you at all actually use it. 😄
body {
background-color: #1d2021
}
.pln,
.pad1,
.pad1 p,
.cline-yes {
color: #fbf1c7
}
@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 {
import NextAuth from "next-auth"
import Providers from "next-auth/providers"
import { addSeconds } from "date-fns"
import type { User } from "hooks/useUser"
import log from "utils/server-logger"
import sessionsDB, { InactiveSessionReason } from "lib/session-db"
import jwtDecode from "jwt-decode"
/** @see https://docs.microsoft.com/en-us/azure/active-directory/develop/id-tokens#payload-claims */
export interface IDToken {