This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useRef, useEffect, useCallback, useState } from 'react'; | |
const useIsMounted = (): () => boolean => { | |
const ref = useRef(false); | |
useEffect(() => { | |
ref.current = true; | |
return () => { | |
ref.current = false; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react' | |
const Card = ({ title, onClick }) => ( | |
<div onClick={onClick} className="card"> | |
<h1>{title}</h1> | |
</div> | |
) | |
const Modal = ({ title, onClose }) => ( | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import escape from 'sql-template-strings'; | |
import { Except } from 'type-fest'; | |
import { query } from '../lib/db'; | |
import { QueryOutput } from '@interfaces/util'; | |
export interface Schoolr_Partner { | |
id?: number; | |
name: string; | |
deleted: boolean; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension URL { | |
var canBeOpened: Bool { | |
return UIApplication.shared.canOpenURL(self) | |
} | |
init(string main: String, fallback secondary: String) { | |
let url = URL(string: main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ValidationOptions, useFormContext, ErrorMessage } from 'react-hook-form'; | |
import {FunctionComponent, useEffect} from 'react'; | |
import cx from 'classnames'; | |
import { ClassValue } from 'classnames/types'; | |
import Select from "./Select"; | |
export interface Props { | |
label?: string; | |
name: string; | |
placeholder?: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
type StorageType = 'local' | 'session'; | |
type SetValueFn<T> = ((item: T) => T) | T; | |
interface StorageModifiers<T extends {}> { | |
set: <K extends keyof T = keyof T>(key: K, value: SetValueFn<T[K]>) => void; | |
get: <K extends keyof T = keyof T>(key?: K) => T[K]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toTS(text: string): string { | |
return text | |
.replace(/\n/, '') | |
.split(';') | |
.map((row) => | |
row | |
.replace(/public|private|internal|static/gi, '') | |
.trim() | |
.replace(/String|Boolean/gi, (v) => v.toLowerCase()) | |
.replace(/Int|Long|Double/gi, 'number') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
enum Section: CaseIterable { | |
case one | |
case two | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AppDelegate.swift | |
// Advanced Clock | |
// | |
// Created by Federico Vitale on 20/05/2019. | |
// Copyright © 2019 Federico Vitale. All rights reserved. | |
// | |
import Cocoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare interface PageableParams<T> { | |
page: number; | |
size?: number; | |
sort?: string[]; | |
sortDirection?: 'asc' | 'desc'; | |
query?: string; | |
} | |
// The result of the endpoint will be | |
declare interface Pageable<T> { |