Skip to content

Instantly share code, notes, and snippets.

View jozsefkerekesdev's full-sized avatar

Jozsef Kerekes jozsefkerekesdev

View GitHub Profile
@jozsefkerekesdev
jozsefkerekesdev / media-friendly-squarespace-accordion
Last active November 30, 2023 16:01
Media friendly Squarespace accordion - ui-workarounds.com
document.querySelectorAll>document.querySelectorAll('.accordion-item__description').forEach((item) => {
const imageExtRegExp = /\.(jpg|jpeg|png|webp|avif|gif|svg)$/;
const videoExtRegExp = /\.(mp4|avi|wmv|mov|flv|mkv|webm|vob|ogv|m4v|3gp|3g2|mpeg|mpg|m2v|m4v|svi|3gpp|3gpp2|mxf|roq|nsv|flv|f4v|f4p|f4a|f4b)$/;
const youtubevimeoRegExp = /(?:https?:)?\/{2}(?:www\.)?youtu\.?be(?:\/|\.com\/watch\?v\=|\.com\/v\/|\.com\/embed\/)?([\w-]*)[?&]?.*|(?:http:|https:|)\/\/(?:player.|www.)?vimeo\.com\/(?:video\/|embed\/|watch\?\S*v=|v\/)?(\d*)/;
item.querySelectorAll('a').forEach((link) => {
const linkParent = link.parentElement;
const nodes = linkParent.childNodes;
const columnize = () => {
nodes.forEach(node => {
if(node.nodeType === Node.TEXT_NODE) {
@jozsefkerekesdev
jozsefkerekesdev / VerificationCodeInput.tsx
Last active May 13, 2023 12:11
2FA Code Input Fields
interface CodeInputProps {
handleCode: (ev: React.ChangeEvent<HTMLInputElement>, value: string, index: number) => void;
handleKey: (ev: React.KeyboardEvent<HTMLInputElement>, index: number) => void;
char: string;
index: number;
maxLength: number
}
const VerificationCodeInput = ({handleCode, handleKey, char, index, maxLength}: CodeInputProps) => {
const handleChange = (ev: React.ChangeEvent<HTMLInputElement>) => {
@jozsefkerekesdev
jozsefkerekesdev / TwoFactorAuthCountDown.tsx
Last active May 13, 2023 12:10
Two Factor Authentication with React and Typescript
import styled from 'styled-components';
import SVG from './TwoFactorAuthCircle';
type CountdownProps = {
percent: number,
remainingSeconds: number | undefined
}
const CountdownDisplay = styled.div`
display: flex;
@jozsefkerekesdev
jozsefkerekesdev / LoginForm.tsx
Last active May 13, 2023 12:07
Remember me functionality with React
import { useEffect, useState } from 'react';
import {Form , Title, FormRow, Input, CheckBox, Button} from './LoginFormStyle';
import { EncryptStorage } from 'encrypt-storage';
interface Credentials {
user: string,
password: string
}
const LoginForm = () => {
@jozsefkerekesdev
jozsefkerekesdev / ImageSlideShow.tsx
Last active May 11, 2023 09:46
Professional React Image Slideshow
import { useEffect, useState } from 'react';
import styled, {css} from 'styled-components';
const Title = styled.h2`
text-align: center
`
const SlideShowWrapper = styled.div`
position: relative;
width: 300px;
padding: 0 60px;
@jozsefkerekesdev
jozsefkerekesdev / TabContent.tsx
Last active May 11, 2023 09:06
React tab system
interface tabContentProps {
tabContent: string;
tabImage: string;
isHidden: boolean;
}
const TabContent = ({tabContent, tabImage, isHidden}: tabContentProps) => {
return (
<div hidden={isHidden}>
<p><img src={tabImage} /></p>