Skip to content

Instantly share code, notes, and snippets.

View peterwilsoncc's full-sized avatar
🌻

Peter Wilson peterwilsoncc

🌻
View GitHub Profile
@peterwilsoncc
peterwilsoncc / typekit.js
Last active December 31, 2015 21:49
Typekit async code
(function(P,W,C,c){
var t={kitId:'xow3svv',scriptTimeout:3000},
y=P.documentElement,p=P.createElement(W),e=false,k=P.getElementsByTagName(W)[0],i,T=setTimeout(function(){y[C]=y[C].replace(/\bwf-loading\b/g,'')+c+"inactive"},t.scriptTimeout);y[C]+=c+"loading";p.src='//use.typekit.net/'+t.kitId+'.js';p.onload=p.onreadystatechange=function(){i=this.readyState;if(e||i&&i!="complete"&&i!="loaded")return;e=true;clearTimeout(T);try{Typekit.load(t)}catch(x){}};k.parentNode.insertBefore(p,k)})(document,'script','className',' wf-');
html {
color: black;
@include lte8 {
color: #111;
}
}
@peterwilsoncc
peterwilsoncc / basic-mailchimp-fields.php
Last active August 29, 2015 13:57
Using the Mailchimp WP plugin in DEV mode with basic fields
<?php
function pwcc_mailchimp_fields( $fields ) {
unset ( $fields );
$fields = array (
0 => array (
"name" => "Email Address",
@peterwilsoncc
peterwilsoncc / width-height-priority.css
Created April 7, 2014 02:53
width and height priority
.set-width {
min-width: 50px; /* overrides */
max-width: 25px; /* which in turn, overrides */
width: 30px;
}
.set-height {
min-height: 50px; /* overrides */
max-height: 25px; /* which in turn, overrides */
height: 30px;
@peterwilsoncc
peterwilsoncc / selector.js
Last active August 29, 2015 13:58
jQuery selector: inputs that have fallen back to type="text"
/*
* $( 'input[type=datetime]' ) selects the inputs regardless
* of the browsers understanding, as does the equivlent CSS
*
* The custom selectors below select the inputs based on the
* fallback, rather than the attribute
*
* USE
* $( 'input:textprop' ); // select inputs displaying as type=text
* $( 'input:nottextprop' ); // select inputs not displaying as type=text
@peterwilsoncc
peterwilsoncc / suitcss-names.css
Last active August 29, 2015 14:02
Trying out a variation of the SUIT CSS naming convention on a personal project. See http://peterwilson.cc/suitcss-naming-convention/
.u-utility {}
.t-templateName {}
.ComponentName {}
.ComponentName-modifierName {}
.ComponentName_descendantName {}
.ComponentName.is-someState {}
.js-ComponentName /* JavaScript hook */
@peterwilsoncc
peterwilsoncc / .htaccess
Created July 11, 2014 00:05
Blocking referer spam
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http(s)?://([^.]+\.)?refererspam.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://([^.]+\.)?spamreferer.com/ [NC]
RewriteRule .* - [F]
</IfModule>
@peterwilsoncc
peterwilsoncc / 100-some-template.json
Last active August 29, 2015 14:05
Pattern lab data file question. Is it possible to include the same atom multiple times & have a json file deal with it?
{
"forms" : {
"textInput" : {
"name" : "textInput", // needs to differ for each instance
"id" : "textInput" // needs to differ for each instance
}
}
}
// some code in here to allow for multiple instances
@peterwilsoncc
peterwilsoncc / micropubfilter.php
Created February 11, 2015 02:50
Include trashed posts in url_to_postid
<?php
function micropub_url_to_postid($url) {
global $wp_rewrite;
/**
* Filter the URL to derive the post ID from.
*
* @since 2.2.0
*
@peterwilsoncc
peterwilsoncc / wp-seo-metabox.diff
Created March 14, 2015 04:03
Fixing the JS error in WP SEO.
diff --git a/content/plugins/wordpress-seo/js/wp-seo-metabox.js b/content/plugins/wordpress-seo/js/wp-seo-metabox.js
index ecbbf24..62a6a46 100644
--- a/content/plugins/wordpress-seo/js/wp-seo-metabox.js
+++ b/content/plugins/wordpress-seo/js/wp-seo-metabox.js
@@ -282,12 +282,12 @@ function yst_updateDesc() {
snippet.find('.desc span.content').html('');
yst_testFocusKw();
- if (tinyMCE.get('excerpt') !== null) {
+ if ( window.tinyMCE && tinyMCE.get('excerpt') !== null) {