This is a list of advanced JavaScript learning resources from people who responded to this [Tweet][13] and this [Tweet][20].
-
[You Don't Know JS][3]
-
[Frontend Masters courses by Kyle Simpson][12]
-
[@mpjme][6]'s [YouTube videos][5]
function removeDropCap(settings, name) { | |
if (name !== 'core/paragraph') { | |
return settings; | |
} | |
let newSettings = Object.assign({}, settings); | |
if (newSettings.supports && | |
newSettings.supports.__experimentalFeatures && | |
newSettings.supports.__experimentalFeatures.typography && | |
newSettings.supports.__experimentalFeatures.typography.dropCap) { | |
newSettings.supports.__experimentalFeatures.typography.dropCap = false |
const listMapper = (list, template) => list.map(template).join('\n') | |
const objectMapper = (object, template) => Object.entries(object).map(template).join('\n') | |
console.log( | |
listMapper( | |
[ | |
'red', | |
'blue', | |
'green' | |
], |
<?php if ( ! is_wp_error( $topics ) && ! empty( $topics ) ) : ?> | |
<div class="cats" data-filter="cat"> | |
<h4><?php pll_e( 'Valitse aihe' ) ?></h4> | |
<ul> | |
<li><a href="<?php echo get_term_link( $term_id ); ?>"<?php echo ( ! isset( $_GET['cat'] ) ) ? ' class="selected"' : ''; ?>><?php _e( 'Kaikki' ) ?></a></li> | |
<?php foreach ( $topics as $topic ) : ?> | |
<li> | |
<a href="<?php echo yeahboy_make_filter_url( $base_url_term_id, 'cat', $topic->term_id ) ?>" data-id="<?php echo $topic->term_id ?>" <?php echo ( $_GET['cat'] == $topic->term_id ) ? ' class="selected"' : ''; ?>> | |
<?php echo $topic->name ?> | |
</a> |
/** | |
* Add support for correct UTF8 orderby for post_title (äöå) | |
* | |
* @param string $orderby ordering clause for query | |
* | |
* @return string ordering clause for query | |
*/ | |
add_filter('posts_orderby', function($orderby) use ($wpdb) { | |
if(strstr($orderby, 'post_title')) { |
<?php | |
// Font Awesome v. 4.6. | |
function jt_get_font_icons() { | |
return array( | |
'fa-glass' => 'f000', | |
'fa-music' => 'f001', | |
'fa-search' => 'f002', | |
'fa-envelope-o' => 'f003', |
NOTE: This is no longer an experiment! You can use the accessibility inspector in Chrome Devtools now, including a fantastic color contrast inspection tool. Read more: https://developers.google.com/web/updates/2018/01/devtools#a11y
Just like any good element inspector helps you debug styles, accessibility inspection in the browser can help you debug HTML and ARIA exposed for assistive technologies such as screen readers. There's a similar tool in Safari (and reportedly one in Edge) but I like the Chrome one best.
As an internal Chrome experiment, this tool differs from the Accessibility Developer Tools extension in that it has privileged Accessibility API access and reports more information as a result. You can still use the audit feature in the Chrome Accessibility Developer Tools, or you could use the aXe Chrome extension. :)
To enable the accessibility inspector in Chrome stable:
<?php | |
/** | |
* Functions for handling font enqueueing, registration, etc. This works with the | |
* Google Fonts API. | |
* | |
* Extending an idea from Jose Castaneda. This is a small script for loading Google fonts | |
* with an easy method for adding/removing/editing the fonts loaded via child theme. | |
* | |
* @link http://blog.josemcastaneda.com/2016/02/29/adding-removing-fonts-from-a-theme/ | |
*/ |
I thought it would be pertinent to respond to some points presented by Andrey "Rarst" Savchenko in recent post Progressive Enhancement.
Unlike Rarst, I don't value progressive enhancement very highly and don't agree it's a fundamental principle of the web that should be universally employed. Quite frankly, I don't care about not supporting JavaScript, and neither does virtually anyone else. It's not that it doesn't have any value, or utility - but in a world where we don't have unlimited resources and time, one has to prioritise what we'll support and not support.
I'm a proponent of putting my ideas and creations into the world for people to make use of; and if I had to cover 100% of use cases for doing that, I wouldn't put much out there. I'm fine with losing the 1.1% of
<?php | |
add_action( 'wp_enqueue_scripts', 'jt_enqueue_scripts' ); | |
function jt_enqueue_scripts() { | |
wp_enqueue_script( 'wp-api' ); | |
wp_enqueue_script( 'wp-util' ); | |
} | |
add_action( 'wp_footer', 'jt_print_post_template', 25 ); |