Skip to content

Instantly share code, notes, and snippets.

@igoro00
igoro00 / Chakra-UI x React-datepicker.md
Last active April 30, 2024 16:15 — forked from baumandm/Chakra-UI x React-datepicker.md
Chakra-UI x React-datepicker

Tiny wrapper component for React-Datepicker to stylistically fit with Chakra-UI 1.x.

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} />

Clearable version:

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} isClearable={true} />
@codingjoe
codingjoe / Procfile
Created January 19, 2021 17:29
Sentry Release on Heroku w/ commits, sourmaps & assets
release: bin/release
web: ...
worker: ...
@SpectralDragon
SpectralDragon / PreviewContextMenu.swift
Created April 8, 2020 19:22
Simple way to implement preview context menu for SwiftUI
//
// ContentView.swift
// PreviewSwiftUI
//
// Created by v.prusakov on 4/8/20.
// Copyright © 2020 v.prusakov. All rights reserved.
//
import SwiftUI
import React, { useRef, useState } from 'react'
import { View, Text, StyleSheet } from 'react-native'
import BottomSheet from 'reanimated-bottom-sheet'
import { FlatList } from 'react-native-gesture-handler'
import { Fragment } from 'react'
const data = Array(50)
.fill(0)
.map((item, index) => ({
id: `item-${index}`,
@VojtaSim
VojtaSim / cursorPagination.ts
Last active December 21, 2022 17:19
TypeORM + TypeGraphQL cursor pagination
import { ObjectType, Field, ClassType, Int, ArgsType } from 'type-graphql';
import { SelectQueryBuilder } from 'typeorm';
import Cursor, { TCursor } from 'scalar/cursor';
@ArgsType()
export class CursorPaginationArgs {
@Field({ nullable: true })
after?: TCursor;
@animir
animir / user.controller.ts
Last active March 2, 2024 08:28
Nest.js prevent brute-force against authorisation example
import { Request, Response } from 'express';
import { Body, Controller, Post, Req, Res } from '@nestjs/common';
import { UserService } from './user.service';
import * as Redis from 'ioredis';
import { RateLimiterRedis } from 'rate-limiter-flexible';
const redisClient = new Redis({enableOfflineQueue: false});
const maxWrongAttemptsByIPperDay = 100;
const maxConsecutiveFailsByUsernameAndIP = 5;
@blwinters
blwinters / SMRecurrenceRule+DateGeneration.swift
Last active July 13, 2021 22:14
This code generates a series of dates based on complex recurrence rules as described in RFC 5445, section 3.8.5 (https://tools.ietf.org/html/rfc5545#section-3.8.5). This is used in Summit to allow users to create repeating tasks on the second Tuesday of January and July, for example.
//
// SMRecurrenceRule.swift
// Summit
//
// Created by Ben Winters on 8/27/17.
// Copyright © 2017 Goals LLC. All rights reserved.
//
import EventKit
import Foundation