Skip to content

Instantly share code, notes, and snippets.

View soulreverie's full-sized avatar

Lydia soulreverie

View GitHub Profile
@adamjohnson
adamjohnson / no-jquery-native-apis.md
Last active December 2, 2022 18:28
A list of "You might not need jQuery" / helpful native API's & methods.

A well designed vanilla JS resource:

https://codetogo.io/

☝️ Can search via method name or the task you want to accomplish.


A great list of commonly used native JS methods and API's:

@aaemnnosttv
aaemnnosttv / gravity-forms-select-optgroupify.php
Created October 5, 2018 09:58
GravityForms filter to allow for grouping select choices into labelled groups using special choice options.
<?php
/**
* Filter for GravityForms to group select field choices by a special "optgroup" choice.
*
* Simply add a new choice with a value of 'optgroup' to the dropdown to start a group of options.
* All following choices will be grouped under it using its label for the group.
* Any number of groups can be created, as each optgroup choice will start a new group.
* Supports field placeholder & ungrouped options, but must be before the first group.
*
* This snippet can be added to your theme's functions.php, or a custom plugin.
@pedrohma
pedrohma / geoLocation.js
Last active June 2, 2023 11:18
Getting Zip Code by GeoLocation using Google Maps API
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
alert("Sorry, but Geolocation is not supported by this browser.");
}
}
function showPosition(position) {
var lat = position.coords.latitude;
@eristic
eristic / functions.php
Last active April 3, 2024 19:42
Gulp file for using Gulp with Underscores theme. Place in root theme directory, saved as gulpfile.js
/*
This is taken directly from here and modified to fit our needs: https://developer.wordpress.org/themes/basics/including-css-javascript/
*/
function add_that_css_and_js() {
wp_enqueue_style( 'enqueue-that-css', get_template_directory_uri() . '/css/main.css', array(), '1.0', 'all');
wp_enqueue_script( 'enqueue-that-js', get_template_directory_uri() . '/js/min/main.min.js', array ( 'jquery' ), 1.0, true);
@markjaquith
markjaquith / wp-update-plugins-git.sh
Created August 5, 2016 13:17
Update all WordPress plugins using WP-CLI and make a separate git commit for each one
#!/bin/bash
PLUGINS=$(wp plugin list --update=available --field=name | tr -d '\r');
wp plugin update-all;
for plugin in $PLUGINS; do
git add -A "wp-content/plugins/$plugin";
git commit -m "Update plugin: $plugin";
done;
@anant1811
anant1811 / acf-genesis-template.php
Last active December 4, 2019 06:54
ACF with Genesis Page templates
<?php
/**
* ACF compatible genesis page template
*
* @author StudioPress
* @package Altitude
* @subpackage Customizations
*/
/*
@danielt69
danielt69 / Detect IE (up to version 12 and Edge).js
Last active November 4, 2016 18:57
Detect IE (up to version 12 and Edge)
// detect IE
var IEversion = detectIE();
if (IEversion !== false) {
// document.getElementById('result').innerHTML = 'IE ' + IEversion;
document.getElementsByTagName("body")[0].classList.add("ie");
document.getElementsByTagName("body")[0].classList.add("ie" + IEversion);
} else {
// document.getElementById('result').innerHTML = 'NOT IE';
}
@Bill77
Bill77 / svg-embed.js
Created October 22, 2015 17:54
A conversion of (an older version of) svg4everybody to an angular directive. Since the functional testing was flaky, we decided to always embed the svg, thus the naming. :)
// Conversion of svg4Everybody into angular format by Bill Chen
// https://github.com/jonathantneal/svg4everybody
(function() {
'use strict';
angular.module('webApp')
.directive('use', svgEmbed);
svgEmbed.$inject = ['$http'];
@annalinneajohansson
annalinneajohansson / change_acf_color_picker.php
Created October 21, 2015 12:00
Adds client custom colors to WYSIWYG editor and ACF color picker. #wordpress
<?php
function change_acf_color_picker() {
$client_colors = array(
"#DD3333",
"#81D742",
"#1E73BE",
"#8224E3",
"#DD9933",
"#EEEE22"
@stowball
stowball / svg-loader.js
Created October 6, 2015 03:31
A lightweight, asynchronous SVG icon system loader
<script>
(function (url) {
var id = 'svg-sprite';
var container;
var xhr = new XMLHttpRequest();
var body = document.body;
if ('withCredentials' in xhr) {
xhr.withCredentials;
xhr.open('GET', url, true);