Skip to content

Instantly share code, notes, and snippets.

Ben Everard beneverard

Block or report user

Report or block beneverard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.17.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.17.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@beneverard
beneverard / query.sql
Created May 24, 2016
A query to list the 404 URLs captured by Redirection (WordPress plugin), ordered by most hits first. Very handy for finding common 404s and handling them with a manual redirect.
View query.sql
SELECT count(id) as count, url
FROM wp_redirection_404
GROUP BY url
ORDER BY count DESC;
@beneverard
beneverard / attachment_rewrite.php
Last active Dec 29, 2015
Rewrite attachment URLs from a local version of WordPress to a remote version.
View attachment_rewrite.php
// remove username:password if you don't need htpasswd auth
add_filter('wp_get_attachment_url', function($url) {
$upload_dir = wp_upload_dir();
$file_path = str_replace(site_url() . '/wp-content/uploads', $upload_dir['basedir'], $url);
// check to see if the file exists locally first
if ( file_exists($file_path) ) {
return $url;
@beneverard
beneverard / caching.apacheconfig
Created Nov 22, 2013
Shropgeek Rebellion - Web performance improvements you can make in one hour. Supplementary code, links and notes. Slides: https://speakerdeck.com/beneverard/shropgeek-rebellion-web-performance-improvements-in-one-hour
View caching.apacheconfig
# CACHING
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType text/html "access plus 1 hour"
ExpiresByType text/richtext "access plus 1 hour"
ExpiresByType text/plain "access plus 1 hour"
View gist:6210413
<?php
$pages = new query_loop( array(
'post_type' => 'page'
));
foreach( $pages as $id => $post ) {
the_title();
// etc...
}
@beneverard
beneverard / caching.apacheconfig
Last active Dec 16, 2015
Points Brighton - Web performance improvements you can make in one hour. Supplementary code and links
View caching.apacheconfig
# CACHING
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType text/html "access plus 1 hour"
ExpiresByType text/richtext "access plus 1 hour"
ExpiresByType text/plain "access plus 1 hour"
View functions.php
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => 'about/meet-the-team', 'with_front'=>false),
'capability_type' => 'page',
'hierarchical' => true,
'menu_position' => null,
View fancy-symbolset.less
//****************
// $SS-ICON $FANCY
[class^="ss-"], [class*=" ss-"], .ss-icon {
&.fancy {
display: inline-block;
margin-right: 5px;
padding: 8px 8px 8px 0;
line-height: 1;
&:before {
@beneverard
beneverard / gist:4543455
Created Jan 16, 2013
Do all font weight / names follow this pattern? Where 100 is hairline, etc.
View gist:4543455
100 Hairline
200 Extra Light
300 Light
400 Regular
500 Medium
600 Semibold
700 Bold
800 ???
900 Black
@beneverard
beneverard / gist:3834707
Created Oct 4, 2012
LESS .font-size mixin
View gist:3834707
.font-size(@font-size: 16) {
@rem: (@font-size / 16);
font-size: @font-size * 1px;
font-size: ~"@{rem}rem";
}
/* usage */
a {
.font-size(16); // 16px
}
You can’t perform that action at this time.