Skip to content

Instantly share code, notes, and snippets.

Avatar
🙏
Never stop learning

Omar López zomars

🙏
Never stop learning
View GitHub Profile
@zomars
zomars / [slug].js
Created Apr 6, 2021 — forked from agungjk/[slug].js
Crawler example on Vercel using Puppeteer and NextJS API routes
View [slug].js
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 }))
View Magic Link 2
View Magic Link 1
@zomars
zomars / useRtDbData.js
Last active Jul 30, 2020 — forked from dsafreno/withDbData.js
Hook version of dsafreno's withDbData for RealTime Database subscribing in React.
View useRtDbData.js
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)
View cpanel-subdomains-creator.php
<?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
@zomars
zomars / renderFieldsArray.js
Created Aug 29, 2018
Render redux-form Fields component
View renderFieldsArray.js
const renderFields = fields =>
Object.keys(fields).map((name, i) => {
if (!fields[name].input) return null;
return (
<Grid item xs={12}>
<Field
key={name}
name={name}
label={fields.labels[i]}
{...fields[name]}
View responsive-logo-04.html
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<style>
.square,
.landscape { visibility: hidden; }
.portrait { visibility: visible; }
@media (min-aspect-ratio: 1/1) {
.portrait,
.landscape { visibility: hidden; }
.square { visibility: visible; }
@zomars
zomars / sort-by.liquid
Last active May 15, 2018
Sort products in Shopify via dropdown in vanilla JavaScript
View sort-by.liquid
{%- comment -%}
Put it in your snippets folder and include it in your templates:
{% include 'sort-by' %}
{%- endcomment -%}
<div id="sort-by-container"></div>
<script>
// Get the URL search parameters
const params = new URLSearchParams(location.search);
const currentParams = params.get('sort_by');
@zomars
zomars / generate-vertical-sprite-from-video.sh
Last active Jan 15, 2018 — forked from vvo/video-snapshots-sprites.sh
generate a vertical sprite sheet from video file
View generate-vertical-sprite-from-video.sh
# 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
View boltflow_inuit_config_local_dev.yml
# This is the DEVELOPMENT version of config_local.yml
# Database credentials.
database:
driver: mysql
databasename: bolt
username: database_user
password: 'hunter42'
# Use unoptimized theme in development