Skip to content

Instantly share code, notes, and snippets.

View wpscholar's full-sized avatar
😀
Happy

Micah Wood wpscholar

😀
Happy
View GitHub Profile
<?php
/**
* A function that takes an array of HTML attribute
* key/value pairs and returns a string of HTML attributes.
**/
function unwrap_html_attrs($attrs)
{
$attributes = '';
@wpscholar
wpscholar / cloudSettings
Last active July 18, 2020 18:11
Visual Studio Code Settings
{"lastUpload":"2020-07-18T18:11:37.497Z","extensionVersion":"v3.4.3"}
@earnjam
earnjam / .bash_profile
Created September 28, 2018 19:39
Custom bash profile
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
# 6. Networking
# 7. System Operations & Information
@uamv
uamv / gf-map-class-to-post-meta.php
Last active January 22, 2024 10:54
Save Gravity Form field data to post meta by adding a class to the field.
<?php
/**
* Save Gravity Form field data to post meta by adding a class to any field.
* Meta is mapped so that it is readable by Advanced Custom Fields
* Format class as…
* post_meta-{meta_key} -- for simple fields & writing lists as array to single meta record
* post_meta-{meta_key}-.3 -- for multi-input fields
* post_meta-{repeater_key}-1.{meta_key} -- for list fields mapped to meta readable by ACF
*/
// Run this function after the Gravity Form has created a post
(function (wp) {
//WordPress APIs
//Render function
var el = wp.element.createElement;
//Translations
var __ = wp.i18n.__;
//Text input control
var TextControl = wp.blocks.InspectorControls.TextControl;
//Create block
wp.blocks.registerBlockType('shelob9/metatest2', {
// https://developers.cloudflare.com/workers/about/
// https://tutorial.cloudflareworkers.com
//
// A Service Worker which adds Security Headers.
// Checks:
// https://securityheaders.io/
// https://observatory.mozilla.org/
// https://csp-evaluator.withgoogle.com/
// https://hstspreload.org/
// https://www.ssllabs.com/ssltest/
@avataru
avataru / EloquentCheatSheet.md
Last active May 7, 2024 17:59
Eloquent relationships cheat sheet
@micc83
micc83 / mysqldump.php
Created June 5, 2017 13:17
Simple PHP script to dump a MySql database
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
@samthor
samthor / safari-nomodule.js
Last active February 14, 2024 02:54
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
@neilgee
neilgee / custom-provision.sh
Created July 13, 2015 02:58
Custom VVV Variable Provisioning for WordPress sites
# #!/bin/bash
# #
# # provision.sh
# #
# # This file is specified in Vagrantfile and is loaded by Vagrant as the primary
# # provisioning script whenever the commands `vagrant up`, `vagrant provision`,
# # or `vagrant reload` are used. It provides all of the default packages and
# # configurations included with Varying Vagrant Vagrants.
# # By storing the date now, we can calculate the duration of provisioning at the