Skip to content

Instantly share code, notes, and snippets.

@cferdinandi
cferdinandi / kraken-addon-checklist.md
Last active August 29, 2015 14:05
Kraken add-on checklists...

Kraken

  • Kraken

Scripts

  • Buoy
  • Astro
  • Drop
  • Houdini
@cferdinandi
cferdinandi / foreach.js
Last active October 1, 2020 08:01
A simple forEach() implementation for Arrays, Objects and NodeLists. Forked from ForEach.js by Todd Motto. https://github.com/toddmotto/foreach
/**
* 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) {
@adamsilverstein
adamsilverstein / expanded_alowed_tags
Last active April 3, 2024 18:15
WordPress expanded allowed tags for wp_kses with iframe, forms, etc.
function expanded_alowed_tags() {
$my_allowed = wp_kses_allowed_html( 'post' );
// iframe
$my_allowed['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
);
@amdrew
amdrew / gist:9313218
Last active April 14, 2017 19:39
Easy Digital Downloads - Show user's purchase history as dashboard widget
<?php
/**
* Register the dasboard widget
*/
function sumobi_edd_register_dashboard_widgets() {
wp_add_dashboard_widget( 'sumobi_edd_purchase_history', __( 'Purchase History', 'edd' ), 'sumbi_edd_purchase_history_widget' );
}
add_action( 'wp_dashboard_setup', 'sumobi_edd_register_dashboard_widgets' );
@cabans
cabans / CSScomb.sublime-settings
Created December 23, 2013 19:08
CSSComb Alphabetical Order
{
"custom_sort_order": true,
"sort_order": [
"-webkit-animation",
"-moz-animation",
"-ms-animation",
"-o-animation",
"animation",
"-webkit-animation-delay",
"-moz-animation-delay",
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active January 8, 2024 13:24
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* 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' ) );
@cferdinandi
cferdinandi / iife.js
Last active December 7, 2017 06:59
An IIFE wrapper for JS functions...
;(function (window, document, undefined) {
'use strict';
// Code goes here...
})(window, document);
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@willurd
willurd / web-servers.md
Last active April 26, 2024 18:00
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@stephenharris
stephenharris / color_luminance.php
Created May 7, 2013 14:19
Lighten or darken a given colour
<?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