Skip to content

Instantly share code, notes, and snippets.

View pietromalerba's full-sized avatar

Pietro Malerba pietromalerba

  • M3
  • Civitanova Marche (MC) - Italy
View GitHub Profile
@pietromalerba
pietromalerba / rushi.txt
Created September 17, 2016 15:33 — forked from rushipkar90/rushi.txt
rushi.txt
prestashop - 500 error
===================
https://www.prestashop.com/forums/topic/421126-request-exceeded-the-limit-of-10-internal-redirects-due-to-probable-configuration-error/
===================
CloudFlare installation:
==========
http://www.cpanelkb.net/cloudflare-plugin-install/
http://crybit.com/install-cloudflare-plugin-on-cpanel/
http://stackoverflow.com/questions/23860877/how-to-install-cloudflare-on-cpanel-servers
@pietromalerba
pietromalerba / functions.php
Created January 10, 2016 18:02 — forked from sardbaba/functions.php
Wordpress - List all hooks
//LIST ALL HOOKS
function dump_hook( $tag, $hook ) {
ksort($hook);
echo "<pre>>>>>>\t$tag<br>";
foreach( $hook as $priority => $functions ) {
echo $priority;
@pietromalerba
pietromalerba / functions.php
Last active September 7, 2015 18:10 — forked from goliver79/functions.php
[WOOCOMMERCE] Get category thumbnail without resize
<?php
/*
* @goliver: overwrite function for get category thumbnail size without resize
* original in woocommerce-template.php
*/
function woocommerce_subcategory_thumbnail( $category ) {
global $woocommerce;
$small_thumbnail_size = apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' );
$dimensions = $woocommerce->get_image_size( $small_thumbnail_size );
@pietromalerba
pietromalerba / gulfile.js
Last active August 26, 2015 14:54 — forked from miziomon/gulfile.js
my gulp config
/*
* https://github.com/gulpjs/gulp
* http://code.tutsplus.com/tutorials/using-gulp-for-wordpress-automation--cms-23081
* https://markgoodyear.com/2014/01/getting-started-with-gulp/
* http://mattbanks.me/gulp-wordpress-development/
*
*/
var gulp = require('gulp'),
through = require('gulp-through'),
<?php
// get next and prev products
// Author: Georgy Bunin (bunin.co.il@gmail.com)
// forked from https://gist.github.com/2176823
function ShowLinkToProduct($post_id, $categories_as_array, $label) {
// get post according post id
$query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array(
array(
'taxonomy' => 'product_cat',
<?php
// place and run in ./plugins/bbpress/bbp-themes
$dirs = array( './bbp-twentyten', './bbp-twentyten/bbpress' );
$actions = array();
$filters = array();
<?php
// include Facebook PHP SDK
include "facebook/facebook.php";
// init Facebook SDK with app settings
$facebook = new Facebook( array( 'appId' => APP_ID, 'secret' => APP_SECRET ) );
// enable file upload support
$facebook->setFileUploadSupport( true );
<?php
include "facebook/facebook.php";
$facebook = new Facebook( array( 'appId' => APP_ID, 'secret' => APP_SECRET ) );
// enable upload support
$facebook->setFileUploadSupport( true );
// set access token for user / page here (not needed if you intend to use the login flow beforehand)
<?php
// turn this:
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
$graphObject = $response->getGraphObject();
// into this:
$graphObject = (new FacebookRequest( $session, 'GET', '/me' ))->execute()->getGraphObject()->asArray();