Skip to content

Instantly share code, notes, and snippets.

@yumyo
yumyo / add-upstream.md
Created March 30, 2017 11:30 — forked from sgnl/add-upstream.md
So you've forked a Repository and you want updates...

#tl;dr

setting up a branch to track a repo

pre: assuming you have forked a repo and cloned your fork to your computer

  1. git remote add [maintainer's name] [paste URL here]
  2. git fetch --all
  3. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track] At this point you may watch to checkout to your newly create branch and issue a git pull command.
@yumyo
yumyo / bower.json
Created March 16, 2017 14:12
Bower Json Package Spec
{
"name": "blue-leaf",
"description": "Physics-like animations for pretty particles",
"main": [
"js/motion.js",
"sass/motion.scss"
],
"dependencies": {
"get-size": "~1.2.2",
"eventEmitter": "~4.2.11"
<?php
$items = array(1,2,3,4,5,6,7,8,9,10,11,12);
$limit = 5;
$qty_items = count($items);
$qty_pages = ceil($qty_items / $limit);
$curr_page = isset($_GET&#91;'page'&#93;) ? $_GET&#91;'page'&#93; : 1;
$next_page = $curr_page < $qty_pages ? $curr_page + 1 : null;
$prev_page = $curr_page > 1 ? $curr_page - 1 : null;
@yumyo
yumyo / schema-wp-extend-output.php
Created January 19, 2017 16:37 — forked from schemapress/schema-wp-extend-output.php
Extend / Override Schema.org JSON_LD Output in WordPress Schema Plugin http://schema.press
<?php //* do not include php tag
add_filter('schema_output', 'schema_wp_extend_output_987345256');
/**
* Extend / Override Schema Output
*
* @since 1.0
*/
function schema_wp_extend_output_987345256( $schema ) {
@yumyo
yumyo / functions.php
Created January 15, 2017 16:12 — forked from wpscholar/functions.php
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
This file has been truncated, but you can view the full file.
[06-Jan-2017 15:52:30 UTC] PHP Notice: Undefined offset: 3 in /code/wp-content/plugins/facetwp/includes/class-helper.php on line 273
[06-Jan-2017 15:52:30 UTC] PHP Stack trace:
[06-Jan-2017 15:52:30 UTC] PHP 1. {main}() /code/wp-admin/admin-ajax.php:0
[06-Jan-2017 15:52:30 UTC] PHP 2. do_action() /code/wp-admin/admin-ajax.php:91
[06-Jan-2017 15:52:30 UTC] PHP 3. WP_Hook->do_action() /code/wp-includes/plugin.php:453
[06-Jan-2017 15:52:30 UTC] PHP 4. WP_Hook->apply_filters() /code/wp-includes/class-wp-hook.php:323
[06-Jan-2017 15:52:30 UTC] PHP 5. call_user_func_array:{/code/wp-includes/class-wp-hook.php:298}() /code/wp-includes/class-wp-hook.php:298
[06-Jan-2017 15:52:30 UTC] PHP 6. FacetWP_Ajax->refresh() /code/wp-includes/class-wp-hook.php:298
[06-Jan-2017 15:52:30 UTC] PHP 7. FacetWP_Facet->render() /code/wp-content/plugins/facetwp/includes/class-ajax.php:265
[06-Jan-2017 15:52:30 UTC] PHP 8. FacetWP_Facet_Dropdown->render() /code/wp-content/plugins/facetwp/includes/class-facet.php:248
@yumyo
yumyo / log_included_fiels.php
Created October 21, 2016 14:11
Log all php includes in WordPress
/*
SHUTDOWN LOG INCLUDED FILES
========================================================================== */
add_action( 'shutdown', __NAMESPACE__ . '\\my_shutdown_callback' );
function my_shutdown_callback() {
$included_files = get_included_files();
foreach ($included_files as $filename) {
error_log("$filename\n");
@yumyo
yumyo / loop-color-shades-output.css
Last active August 3, 2016 09:07
Generated by SassMeister.com.
li {
color: white;
}
li:nth-of-type(1) {
background: #663fb5;
}
li:nth-of-type(2) {
background: #6e49b9;
}
li:nth-of-type(3) {
@mixin font-loaded($safe-family, $custom-family) {
.fonts-loaded & {
font-family: $custom-family;
}
font-family: $safe-family;
}
@yumyo
yumyo / movegfjstofooter.php
Created July 25, 2016 14:49 — forked from eriteric/movegfjstofooter.php
Load gravity forms JS in footer
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );