This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for d in */ ; do | |
mp3PATH=$PWD/"$d" | |
OUTDIR=$(basename "${mp3PATH//\'}") | |
echo $mp3PATH $OUTDIR | |
if [ -d "$mp3PATH" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
views = { | |
"a1": {"position":0,"depends": []}, | |
"a2": {"position":0,"depends": ["a1"]}, | |
"a3": {"position":0,"depends": ["a2"]}, | |
"a5": {"position":0,"depends": ["a9"]}, | |
"a9": {"position":0,"depends": ["a7","a8"]}, | |
"a7": {"position":0,"depends": []}, | |
"a8": {"position":0,"depends": []}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten_json(nested_json, name='', exclude=['']): | |
"""Flatten json object with nested keys into a single level. | |
Args: | |
nested_json: A nested json object. | |
name: A name to cancatenate to the sublevels keys | |
exclude: Keys to exclude from output. | |
Returns: | |
The flattened json object if successful, None otherwise. | |
""" | |
out = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Apply a template to all subcategories of a certain parent category. | |
* | |
* Initial work by Jared Atchison. | |
* http://www.jaredatchison.com/2011/10/02/taking-advantage-of-the-template_include-filter/ | |
* | |
* Revisited by GaryJones https://gist.github.com/GaryJones/1258784 | |
* https://gist.github.com/GaryJones/1258784 | |
* | |
* An improved version of the original Jared/Gary version which checks for, in order, the presence of the templates: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class My_Class { | |
public function __construct () { | |
// Aggiunge verifica email ai campi billing | |
add_filter( 'woocommerce_billing_fields' , array($this, 'woocommerce_billing_fields'), 10, 1 ); | |
add_action( 'woocommerce_checkout_process', array($this, 'woocommerce_checkout_process'), 9 ); | |
} | |
function array_insert(&$array, $position, $insert) { | |
$pos = array_search($position, array_keys($array)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var total = 0; for(var x in localStorage) { var amount = (localStorage[x].length*2)/1024/1024; total += amount; } console.log("Total: "+total.toFixed(10)+" MB"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Produces a dump on the state of WordPress when a not found error occurs */ | |
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */ | |
ini_set( 'error_reporting', -1 ); | |
ini_set( 'display_errors', 'On' ); | |
echo '<pre>'; | |
add_action( 'parse_request', 'debug_404_rewrite_dump' ); | |
function debug_404_rewrite_dump( &$wp ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//LIST ALL HOOKS | |
function dump_hook( $tag, $hook ) { | |
ksort($hook); | |
echo "<pre>>>>>>\t$tag<br>"; | |
foreach( $hook as $priority => $functions ) { | |
echo $priority; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function( $ ) { | |
$( window ).load( function() { | |
function supportsSVG() { | |
return !! document.createElementNS && !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect; | |
} | |
if (!supportsSVG()) { | |
var imgs = document.getElementsByTagName('img'); | |
var dotSVG = /.*\.svg$/; |
NewerOlder