Skip to content

Instantly share code, notes, and snippets.

View reatlat's full-sized avatar
🍋
Life gave me lemons, I forked.

Alex Zappa reatlat

🍋
Life gave me lemons, I forked.
View GitHub Profile
@reatlat
reatlat / prevent-reload-page.js
Last active October 10, 2023 12:14
Enhance your website's debugging experience with prevent-reload-page.js
window.onbeforeunload = function(e) {
var message = "Your confirmation message goes here.", e = e || window.event;
// For IE and Firefox
if (e) {
e.returnValue = message;
}
// For Safari
return message;
};
@reatlat
reatlat / simple-menu.twig
Created April 22, 2023 00:55
HubSpot simple menu example
{% set node = menu(module.menu_field) %}
<ul>
{% for child in node.children %}
<li class="{{ 'has-children' if child.children }} menu-main-item-{{child.level}}">
<a href="{{child.url}}" target="{{ child.linkTarget }}">{{ child.label }}</a>
{% if child.children %}
<ul style="background: yellow">
{% for child2 in child.children %}
<li class="menu-child-depth-{{child2.level}}">
@reatlat
reatlat / wp_auto_login.php
Last active April 28, 2023 01:31
Automatically login a single WordPress user upon arrival to main page.
<?php
/**
* @name WP Auto Login
* @desc Automatically login a single WordPress user upon arrival to main page.
* @author Alex Zappa
* @link https://gist.github.com/reatlat/b3de420eee85cac3e344f981e8f27f87
*/
function auto_login() {
if (!is_user_logged_in()) {
// Admin user_id
@reatlat
reatlat / slugify.twig
Last active July 29, 2023 18:49 — forked from xavianaxw/slugify.html
Hubspot | slugify() | Converting text into slug for Hubspot
{# Helpers: slugify #}
{# Returns the slug version of a string #}
{# Parameters #}
{# string | String to convert into a slug | Required #}
{# How to import this macro to my module #}
{# {% from '[folder]/slugify.html' import slugify %} #}
{# How to use this macro #}
@reatlat
reatlat / debugLog.js
Last active October 31, 2022 18:07
GTM dataLayer example
module.exports = (...args) => {
if (location.hostname.match("local"))
console.log("🦄:", ...args);
};
<?php
return [
'&#xE84D;' => '3d_rotation',
'&#xE190;' => 'access_alarm',
'&#xE191;' => 'access_alarms',
'&#xE192;' => 'access_time',
'&#xE84E;' => 'accessibility',
'&#xE84F;' => 'account_balance',
'&#xE850;' => 'account_balance_wallet',
<a href="#" onclick="download_table_as_csv('my_id_table_to_export');">Download as CSV</a>
@reatlat
reatlat / .gitlab-ci.yml
Created May 15, 2022 01:42 — forked from swashata/.gitlab-ci.yml
Deploy WordPress Plugin with GitLab CI/CD
# Our base image
image: registry.gitlab.com/wpquark/docker-containers/php-node:2.0.0-php-7.3-node-12.13.0
# Select what we should cache
cache:
key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
paths:
- .yarn-cache
- .composer-cache
@reatlat
reatlat / custom-post-hierarchy.php
Created April 18, 2022 19:02 — forked from amurrell/custom-post-hierarchy.php
Allow wordpress posts to have hierarchy - figures out slugs
<?php
add_action('registered_post_type', 'make_posts_hierarchical', 99, 2);
/**
* Ensure posts post type is hierarchal and allows page attributes
*
* Initial Setup - Runs after each post type is registered
*/
function make_posts_hierarchical($post_type, $pto)
@reatlat
reatlat / free_email_provider_domains.txt
Created December 1, 2021 00:02 — forked from tbrianjones/free_email_provider_domains.txt
A list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
126.com
150ml.com
15meg4free.com