A well designed vanilla JS resource:
☝️ Can search via method name or the task you want to accomplish.
A great list of commonly used native JS methods and API's:
A well designed vanilla JS resource:
☝️ Can search via method name or the task you want to accomplish.
A great list of commonly used native JS methods and API's:
| <?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. |
| function getLocation() { | |
| if (!navigator.geolocation) { | |
| alert("Sorry, but Geolocation is not supported by this browser."); | |
| } | |
| navigator.geolocation.getCurrentPosition(showPosition); | |
| } | |
| function showPosition(position) { | |
| var lat = position.coords.latitude; | |
| var long = position.coords.longitude; |
| /* | |
| 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); |
| #!/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; |
| <?php | |
| /** | |
| * ACF compatible genesis page template | |
| * | |
| * @author StudioPress | |
| * @package Altitude | |
| * @subpackage Customizations | |
| */ | |
| /* |
| // 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'; | |
| } |
| // 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']; |
| <?php | |
| function change_acf_color_picker() { | |
| $client_colors = array( | |
| "#DD3333", | |
| "#81D742", | |
| "#1E73BE", | |
| "#8224E3", | |
| "#DD9933", | |
| "#EEEE22" |
| <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); |