Skip to content

Instantly share code, notes, and snippets.

View marklchaves's full-sized avatar
🏄‍♂️

mark l chaves marklchaves

🏄‍♂️
View GitHub Profile
@rxaviers
rxaviers / gist:7360908
Last active April 26, 2024 22:50
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@loilo
loilo / idb-backup-and-restore.md
Last active April 22, 2024 12:17
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'
@basham
basham / css-units-best-practices.md
Last active April 18, 2024 16:44
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@gaearon
gaearon / minification.md
Last active March 4, 2024 12:45
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal:

@selimslab
selimslab / get_gists.py
Last active December 23, 2023 15:52 — forked from leoloobeek/get_gists.py
Download all gists of a user
import sys
from subprocess import call
import json
import os
import requests
def download_gists(gists: list):
for gist in gists:
call(["git", "clone", gist["git_pull_url"]])
@studiopress
studiopress / nav-extras.php
Last active September 11, 2023 21:24
Modify the nav extras.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
add_filter( 'wp_nav_menu_items', 'theme_menu_extras', 10, 2 );
/**
* Filter menu items, appending either a search form or today's date.
*
* @param string $menu HTML string of list items.
* @param stdClass $args Menu arguments.
*
@webtoffee-git
webtoffee-git / functions.php
Last active December 9, 2022 14:10
Add more scripts to the default script blocker list using WebToffee GDPR Cookie Consent plugin
function scripts_list() {
$scripts = array(
array(
'id' => 'googletranslator',
'label' => 'GoogleTranslator',
'key' => array('translate.google.com/translate_a/element.js'),
'category' => 'analytics',
'status' => 'yes'
),
);
@marklchaves
marklchaves / popup_name_sc.php
Last active September 29, 2022 22:38
Make a shortcode for a popup's name (not the title)
<?php // Ignore this first line when copying to your child theme's functions.php file.
/**
* Make a shortcode for a popup's name (not the title)
*
* Note: The popup's internal name is actually the CPT's title.
* The internal name is different from the popup's title.
*
* The popup's title is optional. If you enter a popup title,
* it displays as the heading of your popup (external title).
@danieliser
danieliser / custom.js
Last active July 14, 2022 22:58
Use this to convert form values into a url, then change the iFrame src inside a Popup Maker popup, before opening the popup.
(function ($, document) {
// Customize these variables.
// ----------------------------------
var popupID = 123,
form = $('#form'),
// ------------------------------
// End Customizations.
baseURL = form.attr('action'),
popup = $('#pum-' + popupID),
iframe = popup.find('iframe').eq(0);
@lupin72
lupin72 / gist:91b7f744beb0478c805e9a26b504b753
Created June 2, 2018 15:33
How to block Monterinsights' Google Analytics Cookies with iubenda Cookie Solution for GDPR
function block_monsterinsights_cookies($attr) {
$attr['type'] = "text/plain";
$attr['class'] = '_iub_cs_activate';
return $attr;
}
add_filter('monsterinsights_tracking_analytics_script_attributes', 'block_monsterinsights_cookies', 10);