Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View MelMacaluso's full-sized avatar
🌝
You are very curious, aren't ya?

Mel Macaluso MelMacaluso

🌝
You are very curious, aren't ya?
View GitHub Profile
@MelMacaluso
MelMacaluso / expose_ACF_fields_to_REST.php
Created June 4, 2019 22:54
Automatically expose all the ACF fields to the Wordpress REST API in Pages and in your custom post types.
<?php
function create_ACF_meta_in_REST() {
$postypes_to_exclude = ['acf-field-group','acf-field'];
$extra_postypes_to_include = ["page"];
$post_types = array_diff(get_post_types(["_builtin" => false], 'names'),$postypes_to_exclude);
array_push($post_types, $extra_postypes_to_include);
foreach ($post_types as $post_type) {
register_rest_field( $post_type, 'ACF', [
@MelMacaluso
MelMacaluso / index.html
Created February 18, 2019 20:26
intersection Observer Scrolling
<link href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<main data-mhm-scroll-sections>
<section class="bg-center bg-cover" data-mhm-scroll-section="0">
<h2>Section 1</h2>
</section>
@MelMacaluso
MelMacaluso / default.conf
Created December 4, 2018 11:50
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@MelMacaluso
MelMacaluso / StringToValidCssClass.js
Last active August 22, 2018 17:30 — forked from dbowling/gist:2589645
Convert text to a valid CSS class name
string = 'Invalid C$$ class name';
// Actually delete the spaces too...
string.replace(/[!\"#$%&'\(\)\*\+,\.\/:;<=>\?\@\[\\\]\^`\{\|\}|\s~]/g, '').toLowerCase();