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
/** | |
* @param {array} array | |
* @param {string} attribute | |
* @param {array} sortOrder | |
*/ | |
function customArraySort (array, attribute, sortOrder) { | |
let ordering = {} | |
for (let i = 0; i < sortOrder.length; i++) { | |
ordering[sortOrder[i]] = i | |
} |
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 timeBetweenDates (dateTo, dateFrom) { | |
// get total seconds between the times | |
let delta = Math.abs(date_future - date_now) / 1000 | |
// calculate (and subtract) whole days | |
let days = Math.floor(delta / 86400) | |
delta -= days * 86400 | |
// calculate (and subtract) whole hours | |
let hours = Math.floor(delta / 3600) % 24 | |
delta -= hours * 3600 | |
// calculate (and subtract) whole minutes |
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
export function camelCaseKeys(object) { | |
let camelCaseObject = _.cloneDeep(object) | |
if (_.isArray(camelCaseObject)) { | |
return _.map(camelCaseObject, camelCaseKeys) | |
} | |
if (_.isString(camelCaseObject)) { | |
return camelCaseObject | |
} | |
camelCaseObject = _.mapKeys(camelCaseObject, (value, key) => _.camelCase(key)) |
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
<?php | |
// Hide payment gateways based on shipping method | |
function payment_gateway_disable( $available_gateways ) { | |
global $woocommerce; | |
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' ); | |
$chosen_shipping = $chosen_methods[0]; | |
if( $chosen_shipping == 1479475819 ) { | |
unset($available_gateways['cod']); | |
} |
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 Attachment < ApplicationRecord | |
has_attached_file :file, | |
styles: ->(a) { a.instance.paperclip_styles }, | |
path: 'public/system/:class/:id/:style_:filename', | |
url: '/system/:class/:id/:style_:filename' | |
validates_attachment_presence :file | |
def paperclip_styles |
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
// Funzione da richiamare nel document.ready | |
var scrollEffectsInit = function() { | |
if($(window).width() > 1024) { | |
$('.animate').css('opacity', '0'); | |
$('.animate-left').css('left', '-100px'); | |
$('.animate-right').css('right', '-100px'); | |
$('.animate-top').css('top', '-100px'); | |
$('.animate-bottom').css('bottom', '-100px'); | |
} | |
} |
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
<?php | |
// Rimozione aggiornamenti wp | |
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) ); | |
// Rimozione aggiornamenti wp-plugin | |
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) ); | |
?> |
NewerOlder