Skip to content

Instantly share code, notes, and snippets.

Peter Wilson peterwilsoncc

Block or report user

Report or block peterwilsoncc

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
@peterwilsoncc
peterwilsoncc / 100-some-template.json
Last active Aug 29, 2015
Pattern lab data file question. Is it possible to include the same atom multiple times & have a json file deal with it?
View 100-some-template.json
{
"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 / .htaccess
Created Jul 11, 2014
Blocking referer spam
View .htaccess
<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 / suitcss-names.css
Last active Aug 29, 2015
Trying out a variation of the SUIT CSS naming convention on a personal project. See http://peterwilson.cc/suitcss-naming-convention/
View suitcss-names.css
.u-utility {}
.t-templateName {}
.ComponentName {}
.ComponentName-modifierName {}
.ComponentName_descendantName {}
.ComponentName.is-someState {}
.js-ComponentName /* JavaScript hook */
@peterwilsoncc
peterwilsoncc / selector.js
Last active Aug 29, 2015
jQuery selector: inputs that have fallen back to type="text"
View selector.js
/*
* $( '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
View width-height-priority.css
.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 / basic-mailchimp-fields.php
Last active Aug 29, 2015
Using the Mailchimp WP plugin in DEV mode with basic fields
View basic-mailchimp-fields.php
<?php
function pwcc_mailchimp_fields( $fields ) {
unset ( $fields );
$fields = array (
0 => array (
"name" => "Email Address",
View 0500up.scss
html {
color: black;
@include lte8 {
color: #111;
}
}
@peterwilsoncc
peterwilsoncc / typekit.js
Last active Dec 31, 2015
Typekit async code
View typekit.js
(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-');
@peterwilsoncc
peterwilsoncc / actions.js
Created Aug 21, 2013
add_action, do_action in Javascript
View actions.js
function add_action( action_name, callback, priority ) {
if ( ! priority ) {
priority = 10;
}
if ( priority > 100 ) {
priority = 100;
}
if ( priority < 0 ) {
@peterwilsoncc
peterwilsoncc / singleton-for-wordpress-themes.php
Last active Dec 20, 2015
Experimenting with singletons for WordPress themes - it makes it easier than dozens of calls to function_exists(), I think. Maybe.
View singleton-for-wordpress-themes.php
<?php
/* Child Theme's functions.php */
function collaborate_class_init() {
class Collaborate extends Collaborate_Parent_Theme {
public static function theme() {
if ( ! Collaborate::$instance instanceof self ) {
Collaborate::$instance = new self();
}
You can’t perform that action at this time.