A Pen by Vitaliy Ralle on CodePen.
require "compass" | |
# Require any additional compass plugins here. | |
require "autoprefixer-rails" | |
require "csso" | |
# Set this to the root of your project when deployed: | |
http_path = "../" | |
css_dir = "css" | |
sass_dir = "_sass" | |
images_dir = "images" |
<?php | |
// Remove Akismet js | |
function vralle_remove_akismet_script () { | |
remove_action( 'comment_form', array( 'Akismet', 'load_form_js' ) ); | |
} | |
if ( ! is_admin() && ( defined( 'AKISMET_VERSION' ) || function_exists( 'akismet_http_post' ) ) ) { | |
add_action( 'wp_enqueue_scripts', 'vralle_remove_akismet_script' ); | |
} |
// ### Convert an HTML-representation of an object to a string. | |
function myHTML() { | |
// Save default function | |
var defaultHTML = wp.html.string; | |
// image intercept | |
wp.html.string = function( options ) { | |
// If image, send new function | |
if( 'img' === options.tag ) { | |
return shortcake.html( options ); | |
} |
<?php namespace Vralle\Plugin\Shortcode\Img; | |
/*------------------------------------------------------------------- | |
* Register UI | |
*-----------------------------------------------------------------*/ | |
function editor_ui() { | |
global $_wp_additional_image_sizes; | |
$default_sizes = [ |
<?php namespace Vralle\Plugin\Shortcode\Img; | |
/*------------------------------------------------------------------- | |
* Convert images to Shortcode | |
*-----------------------------------------------------------------*/ | |
function html_to_shortcode( $content ) { | |
// Returns, if content is empty | |
if( empty( $content ) ) return $content; | |
if( 'content_save_pre' === current_filter() ) |
/** | |
* Single image | |
* @link https://ampbyexample.com/components/amp-img/ | |
*/ | |
$single_image = array( | |
'element' => 'amp-img', | |
'attributes' => array(), | |
); | |
/** |
A Pen by Mike Sozanski on CodePen.
<?php | |
/** | |
* Stop each TSF meta output. | |
*/ | |
add_filter( 'the_seo_framework_sitemap_hpt_query_args', 'vralle_no_sitemap' ); | |
add_filter( 'the_seo_framework_articles_data', 'vralle_no_article_json' ); | |
add_filter( 'the_seo_framework_robots_meta_array', 'vralle_no_search_robots_meta' ); | |
add_filter( 'the_seo_framework_use_og_tags', 'vralle_no_meta' ); | |
add_filter( 'the_seo_framework_use_facebook_tags', 'vralle_no_meta' ); | |
add_filter( 'the_seo_framework_use_twitter_tags', 'vralle_no_meta' ); |
https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce
method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List
is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu