Skip to content

Instantly share code, notes, and snippets.

View whatjackhasmade's full-sized avatar
🏄‍♂️
Surfing the www.

Jack Pritchard whatjackhasmade

🏄‍♂️
Surfing the www.
View GitHub Profile
@whatjackhasmade
whatjackhasmade / hide.scss
Created June 5, 2017 10:51
Hidden + Accessible Text
.visually-hidden { /*https://developer.yahoo.com/blogs/ydn/clip-hidden-content-better-accessibility-53456.html*/
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
padding:0 !important;
border:0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden;
}
@whatjackhasmade
whatjackhasmade / header__url-meta.html
Created June 5, 2017 10:57
"The Open Graph protocol enables any web page to become a rich object in a social graph." - http://ogp.me/
<meta property="og:image" content="" />
<meta property="og:description" content="" />
<meta property="og:title" content="" />
<meta property="og:locale" content="en_GB" />
<meta property="og:site_name" content="" />
@whatjackhasmade
whatjackhasmade / normalize.scss
Created June 5, 2017 10:59
normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
@whatjackhasmade
whatjackhasmade / not.scss
Last active June 5, 2017 11:10
Mixin - Not
/*/////////////////////////////////////////
/// NOT
*/////////////////////////////////////////
@mixin not($ignorList...) {
//if only a single value given
@if (length($ignorList) == 1){
//it is probably a list variable so set ignore list to the variable
$ignorList: nth($ignorList,1);
}
@whatjackhasmade
whatjackhasmade / active-states.scss
Last active June 6, 2017 09:24
Mixin - Active States
/*/////////////////////////////////////////
/// ACTIVE STATES
*/////////////////////////////////////////
@mixin active-states() {
&:hover,
&:focus,
&:active { @content }
}
@whatjackhasmade
whatjackhasmade / media-queries.scss
Last active June 5, 2017 11:12
Mixin - Media Queries
/*/////////////////////////////////////////
/// MEDIA QUERIES
*/////////////////////////////////////////
/**
* Mixins for defining media queries. These mixins should always be used
* to define media query breakpoints.
*/
@mixin bp-min-width($width) {
@whatjackhasmade
whatjackhasmade / functions.php
Created June 5, 2017 11:17
functions.php - Remove WP Emoji
// Remove WP Emoji
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
@whatjackhasmade
whatjackhasmade / functions.php
Created June 5, 2017 11:18
functions.php - Remove JQuery/Migrate and WP Embed
// Remove jQuery Migrate Script from header and Load jQuery from Google API
function crunchify_stop_loading_wp_embed_and_jquery() {
if (!is_admin()) {
wp_deregister_script('wp-embed');
wp_deregister_script('jquery'); // Bonus: remove jquery too if it's not required
}
}
add_action('init', 'crunchify_stop_loading_wp_embed_and_jquery');
@whatjackhasmade
whatjackhasmade / functions.php
Created June 5, 2017 16:57
Include additional pages to wordpress admin dashboard
function register_my_custom_menu_page() {
add_menu_page( 'Page Title', 'Menu Title', 'manage_options', '../wp-content/themes/index.html', '', 'dashicons-book', 3 );
}
add_action( 'admin_menu', 'register_my_custom_menu_page' );
@whatjackhasmade
whatjackhasmade / functions.php
Last active June 6, 2017 09:22
Allow SVG files to be uploaded to the media library
// Allow SVG files to be uploaded to the media library
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
global $wp_version;
if ( $wp_version !== '4.7.1' ) {
return $data;
}
$filetype = wp_check_filetype( $filename, $mimes );