The idea is based on a gist by @jimbojsb.
You can use Pygments or Highlight.
brew install python
/** | |
* A simple forEach() implementation for Arrays, Objects and NodeLists | |
* @private | |
* @param {Array|Object|NodeList} collection Collection of items to iterate | |
* @param {Function} callback Callback function for each iteration | |
* @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`) | |
*/ | |
var forEach = function (collection, callback, scope) { | |
if (Object.prototype.toString.call(collection) === '[object Object]') { | |
for (var prop in collection) { |
<?php | |
/** | |
* Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7 | |
* @param str $hex Colour as hexadecimal (with or without hash); | |
* @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() ) | |
* @return str Lightened/Darkend colour as hexadecimal (with hash); | |
*/ | |
function color_luminance( $hex, $percent ) { | |
// validate hex string |
<?php | |
/** | |
* _s Theme Options | |
* | |
* @package _s | |
* @since _s 1.0 | |
*/ | |
/** | |
* Register the form setting for our _s_options array. |
The idea is based on a gist by @jimbojsb.
You can use Pygments or Highlight.
brew install python
var list = document.getElementsByClassName('pl-video-time'); | |
var time = 0; | |
function toS(hms) { | |
var a = hms.split(':'); | |
while (a.length < 3) { | |
a.unshift(0); | |
} | |
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]); | |
return seconds; |
/** | |
* Optimize WooCommerce Scripts | |
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages. | |
*/ | |
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 ); | |
function child_manage_woocommerce_styles() { | |
//remove generator meta tag | |
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); |
This is a tiny content strategy framework focused on goals, messages, and branding. This is not a checklist. Use what you need and scrap the rest. Rewrite it or add to it. These topics should help you get to the bottom of things with clients and other people you work with.
Give me feedback on Twitter (@nicoleslaw) or by email (nicole@nicolefenton.com).
#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
// See http://rosskendall.com/blog/web/javascript-function-to-check-an-email-address-conforms-to-rfc822 | |
function isEmail(email){ | |
return /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/.test( email ); | |
} |