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
@zomars
zomars / generate-vertical-sprite-from-video.sh
Last active March 3, 2023 18:24 — forked from vvo/video-snapshots-sprites.sh
generate a vertical sprite sheet from video file
# fps=10
ffmpeg -i video.mp4 -f image2 -vf fps=fps=10 img%03d.jpg
# vertical sprite
files=$(ls img*.jpg | sort -t '-' -n -k 2 | tr '\n' ' ')
convert $files -append output.jpg
# references:
# http://www.imagemagick.org/script/command-line-options.php#append
# http://www.imagemagick.org/script/command-line-options.php#resize
@zomars
zomars / modularized-nextjs-project-strucutre.md
Last active July 28, 2022 23:26
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)
@zomars
zomars / README.md
Created May 30, 2022 21:53
End to end API type safety with SWR and Next.js

Idea

Being able to auto type API endpoint according the use. This could be achieveable using TypeScript template literals.

Example:

Having these API endpoints:

  • /api/users
  • /api/companies
@zomars
zomars / README.md
Created May 30, 2022 21:52
End to end API type safety with SWR and Next.js

Idea

Being able to auto type API endpoint according the use. This could be achieveable using TypeScript template literals.

Example:

Having these API endpoints:

  • /api/users
  • /api/companies
@zomars
zomars / DangerousRawHtml.jsx
Created May 30, 2022 18:20
Inject raw html comments using React
export const DangerousRawHtml = ({ html = "" }) => (
<script dangerouslySetInnerHTML={{ __html: `</script>${html}<script>` }} />
);
@zomars
zomars / [slug].js
Created April 6, 2021 20:43 — forked from agungjk/[slug].js
Crawler example on Vercel using Puppeteer and NextJS API routes
const puppeteer = require('puppeteer-core');
const cheerio = require('cheerio');
const chrome = require('chrome-aws-lambda');
export default async (req, res) => {
const slug = req?.query?.slug;
if (!slug) {
res.statusCode = 200
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ id: null }))
@zomars
zomars / Magic Link 1
Created October 19, 2020 22:23 — forked from cosmos-sajal/Magic Link 1
Magic Link 1
@zomars
zomars / useRtDbData.js
Last active July 30, 2020 19:09 — forked from dsafreno/withDbData.js
Hook version of dsafreno's withDbData for RealTime Database subscribing in React.
import { useEffect, useRef, useState } from 'react';
import firebase from 'firebase/app';
import equal from 'deep-equal';
function filterKeys(raw, allowed) {
if (!raw) {
return raw;
}
const s = new Set(allowed);
return Object.keys(raw)
<?php
###############################################################
# cPanel Subdomains Creator 1.1
###############################################################
# Visit http://www.zubrag.com/scripts/ for updates
###############################################################
#
# Can be used in 3 ways:
# 1. just open script in browser and fill the form