Skip to content

Instantly share code, notes, and snippets.

View zomars's full-sized avatar
🙏
Never stop learning

Omar López zomars

🙏
Never stop learning
View GitHub Profile
@everdimension
everdimension / Input.tsx
Last active April 29, 2025 07:12
React Input element with support for customValidity props
/**
* Usage:
* <Input customValidity="your validation message" /> // add constraint
* or
* <Input customValidity="" /> // remove constraint
* or
* <Input defaultCustomValidity="you message" /> // initial validationMessage
*/
export function Input({
defaultCustomValidity,
@zainarbani
zainarbani / decrypt.py
Created March 4, 2024 07:25
F670L decrypt
import sys
import argparse
import struct
import zlib
from os import stat
from io import BytesIO
from hashlib import sha256
from Cryptodome.Cipher import AES
"""Magic number constants from ZTE routers"""
@feedthejim
feedthejim / import-timing-plugin.js
Created April 10, 2023 20:47
Webpack Import timing plugin
const { ConcatSource } = require('webpack-sources')
class ImportTimingPlugin {
constructor(options = {}) {
this.options = options
}
apply(compiler) {
compiler.hooks.compilation.tap('ImportTimingPlugin', (compilation) => {
compilation.hooks.processAssets.tap(
@bashbunni
bashbunni / .zshrc
Last active June 21, 2026 22:47
CLI Pomodoro for Mac
# I'll be doing another one for Linux, but this one will give you
# a pop up notification and sound alert (using the built-in sounds for macOS)
# Requires https://github.com/caarlos0/timer to be installed
# Mac setup for pomo
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\
-title 'Work Timer is up! Take a Break 😊'\
-appIcon '~/Pictures/pumpkin.png'\
-sound Crystal"
@belgattitude
belgattitude / ci-yarn-install.md
Last active October 14, 2025 07:43
Composite github action to improve CI time with yarn 3+ / node-modules linker.
@lyzs90
lyzs90 / handler.ts
Created June 29, 2022 16:01
Next.js Stripe Webhook Handler
import { NextApiRequest, NextApiResponse } from 'next';
import Stripe from 'stripe';
import { Readable } from 'node:stream';
export const config = {
api: {
bodyParser: false,
},
};
@zomars
zomars / modularized-nextjs-project-strucutre.md
Last active May 28, 2024 18:19
Reusable Next.js project structure

File structure

The main file structure is organized as follows:

├── __test__
├── assets
├── configs
├── modules
│   ├── common (Here is what is reused in various modules)
@franky47
franky47 / stripe-webhooks.ts
Created December 21, 2021 09:44
Strongly-typed webhook handlers for Stripe (Node.js)
import type { Stripe } from 'stripe'
export type StripeWebhookEventTypes =
Stripe.WebhookEndpointCreateParams.EnabledEvent
export type StripeWebhookEvent<
EventType extends StripeWebhookEventTypes,
Payload
> = {
eventType: EventType
@ianobermiller
ianobermiller / index.html
Created July 12, 2021 00:47
WiFi QR Code, single HTML file
<!DOCTYPE html>
<html>
<head>
<title>WiFi Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- https://news.ycombinator.com/item?id=26923316 -->
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>&#128272;</text></svg>">
<style>
body, textarea {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
@nenadfilipovic
nenadfilipovic / Profile.tsx
Created June 26, 2021 16:41
Correctly infer prop types from getServerSideProps function
const Profile = ({
user,
}: InferGetServerSidePropsType<typeof getServerSideProps>): JSX.Element => {
return (
<section>
<div>{user.image}</div>
<div>{user.name}</div>
<div>{user.email}</div>
<div>{user.role}</div>
<div>{user.id}</div>