Skip to content

Instantly share code, notes, and snippets.

View hectorromo's full-sized avatar

Hector Romo hectorromo

View GitHub Profile
@tomhicks
tomhicks / plink-plonk.js
Last active November 12, 2024 19:08
Listen to your web pages
Seven different types of CSS attribute selectors
// This attribute exists on the element
[value]
// This attribute has a specific value of cool
[value='cool']
// This attribute value contains the word cool somewhere in it
[value*='cool']
@ajxchapman
ajxchapman / README.md
Last active February 20, 2025 17:25
Install Windows on Digital Ocean droplet
@mikowl
mikowl / oneliners.js
Last active February 19, 2025 05:20
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@bvaughn
bvaughn / LICENSE.md
Last active April 27, 2025 22:07
Advanced example for manually managing subscriptions in an async-safe way using hooks

The MIT License (MIT)

Copyright © <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

/* --------------------------------
Typography
-------------------------------- */
:root {
--font-primary: sans-serif;
--font-secondary: serif;
@WebInspectInc
WebInspectInc / docker-compose.yml
Created June 5, 2018 01:50
A basic Docker Compose file for WordPress
version: '3'
services:
mysql:
image: mysql:5.7
volumes:
- ./db:/docker-entrypoint-initdb.d
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
@ontiuk
ontiuk / woocommerce-select2-selectwoo-remove
Last active December 5, 2024 14:24
Woocommerce Remove Select2 / SelectWoo
// Add to your theme's functions.php file. De-queues Select2 styles & scripts. Useful to keep Boostrap form control formatting
/**
* Remove Woocommerce Select2 - Pre WC 3.2.1-ish
*/
function woo_dequeue_select2() {
if ( class_exists( 'woocommerce' ) ) {
wp_dequeue_style( 'select2' );
wp_deregister_style( 'select2' );
@fre-sch
fre-sch / app.jsx
Created March 12, 2018 06:48
preact drag and drop
import {h, Component} from "preact"
const lorem = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."
class DndListItem extends Component {
render({onDragStart, children}) {
return (
<div class="dnd-list-item"
draggable="true"
onDragStart={onDragStart}>
@atinux
atinux / async-foreach.js
Last active April 2, 2025 11:34
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)