Skip to content

Instantly share code, notes, and snippets.

Avatar

Ross Morsali rmorse

View GitHub Profile
@wwwebman
wwwebman / docker-compose.yml
Last active Mar 29, 2020
Docker Compose For Wordpress, Maria/MYSQL, phpMyAdmin
View docker-compose.yml
version: '2'
services:
db:
container_name: database
image: mariadb # Pull mysql image from Docker Hub
ports: # Set up ports exposed for other containers to connect to
- "3306:3306"
volumes:
- ./dep/mysql:/docker-entrypoint-initdb.d
@JeffMatson
JeffMatson / get_actions.php
Last active Feb 7, 2016
Prints the actions fired in WordPress, and how many times
View get_actions.php
<?php
add_action( 'shutdown', function(){
foreach( $GLOBALS['wp_actions'] as $action => $count )
printf( '%s (%d) <br/>' . PHP_EOL, $action, $count );
});
@Restuta
Restuta / framework-sizes.md
Last active Aug 8, 2020
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)
View framework-sizes.md

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan  4 22:03 angular2.min.js
@lukin0110
lukin0110 / GulpReactBrowserifyBabelify.md
Last active May 3, 2020
Gulp + browserify + babelify + react
View GulpReactBrowserifyBabelify.md

Use React with Gulp, Browserify and Babelify. This allows you to use React in jsx & node.js style. It let's you use require('module') in your JavaScript. Babelify will transform the jsx code to JavaScript code.

Development

gulp build-react

This will generate a main.min.js file in the build directory with sourcemaps.

Production

View gist:eb3c5b834e65b3a76756
/* start new bbpress */
.bbp-topic-voice-count {
display: none;
}
.bbp-topic-reply-count {
color: #aaa;
font-size: 80%;
margin-right: 20px !important;
width: inherit !important;
@corsonr
corsonr / gist:9597159
Created Mar 17, 2014
jQuery UI Datepicker French localization
View gist:9597159
/* French initialisation for the jQuery UI date picker plugin. */
/* Written by Keith Wood (kbwood{at}iinet.com.au),
Stéhane Nahmani (sholby@sholby.net),
Stéphane Raimbault <stephane.raimbault@gmail.com> */
jQuery(function($){
$.datepicker.regional['fr'] = {
closeText: 'Fermer',
prevText: 'Précédent',
nextText: 'Suivant',
currentText: 'Aujourd\'hui',
@kasparsd
kasparsd / custom-post-taxonomy-permalinks.php
Created Jun 13, 2012
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
View custom-post-taxonomy-permalinks.php
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
@mikejolley
mikejolley / functions.php
Last active Aug 7, 2018
WooCommerce - Show quantity inputs for simple products within loops.
View functions.php
<?php
/**
* Code should be placed in your theme functions.php file.
*/
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= woocommerce_quantity_input( array(), $product, false );
@wesbos
wesbos / is_blog.php
Created Sep 2, 2011
WordPress is_blog()
View is_blog.php
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
@supermethod
supermethod / Wordpress RSS 2.0 image enclosure
Created Mar 8, 2011
How to add an enclosure to a wordpress RSS feed using the first image of the post - add to functions.php
View Wordpress RSS 2.0 image enclosure
function feedFilter($query) {
if ($query->is_feed) {
add_filter('rss2_item', 'feedContentFilter');
}
return $query;
}
add_filter('pre_get_posts','feedFilter');
function feedContentFilter($item) {
You can’t perform that action at this time.