Skip to content

Instantly share code, notes, and snippets.

View samikeijonen's full-sized avatar
🏠
Working from home

Sami Keijonen samikeijonen

🏠
Working from home
View GitHub Profile
@devinsays
devinsays / custom_edd_sl_license_response
Last active August 29, 2015 14:02
Allow "Package" downloads. Multiple file downloads using the same license.
/**
* This code requires one additional filter param to be added to edd_sl_license_response in EDD_Software_Licensing.php:
* $response = apply_filters( 'edd_sl_license_response', $params, $download, $data)
*/
/**
* Allows EDD to bypass the name check for files
*/
define( 'EDD_BYPASS_NAME_CHECK', true );
@justintadlock
justintadlock / fonts.php
Last active July 13, 2016 15:15
Enqueue fonts in WP
<?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/
*/
<?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>

I thought it would be pertinent to respond to some points presented by Andrey "Rarst" Savchenko in recent post Progressive Enhancement.

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 );
@tomhodgins
tomhodgins / map-test.js
Last active May 3, 2019 06:47
run with -> $deno map-test.js | prettier --parser css > output.css
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'
],
/**
* 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')) {
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
@justintadlock
justintadlock / font-awesome.php
Last active September 28, 2021 11:09
PHP array of Font Awesome icons.
<?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',
@pento
pento / commercial-client.php
Created July 2, 2013 12:29
Sample Commercial Plugin update server and client
<?php
/*
* Plugin Name: Commercial Client
* Plugin URI: http://pento.net/
* Description: A sample client plugin for showing updates for non-WordPress.org plugins
* Author: pento
* Version: 0.1
* Author URI: http://pento.net/
* License: GPL2+
*/