Skip to content

Instantly share code, notes, and snippets.

@bUxEE
bUxEE / monthly.css
Last active November 27, 2018 21:16
/* Overall wrapper */
.monthly {
background: #F3F3F5;
color: #545454;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
position: relative;
@bUxEE
bUxEE / encrypt-decrypt.php
Created October 12, 2018 13:49
encrypt decrypt
function cookie_decrypt_tool() {
$encrypted_payload = urldecode($_POST["content"]);
$encrypted_payload = substr( $encrypted_payload, 0, 3 ) === "%0A" ? substr($encrypted_payload, 3) : $encrypted_payload;
if (in_array("aes-128-cbc", openssl_get_cipher_methods())) {
$c = base64_decode($encrypted_payload);
$ivlen = openssl_cipher_iv_length('aes-128-cbc');
$iv = substr($c, 0, $ivlen);
$hmac = substr($c, $ivlen, $sha2len=32);
$ciphertext_raw = substr($c, $ivlen+$sha2len);
$original_plaintext = openssl_decrypt($ciphertext_raw, 'aes-128-cbc', KEY_CRIPTAZIONE_COOKIE_CUSTOMER_JOURNEY, $options=OPENSSL_RAW_DATA, $iv);
/**
* Extra emails wc
*/
class wopeckoStatusEmails {
function __construct($id,$title,$description) {
$this->ID = $id;
$this->title = $title;
$this->description = $description;
@bUxEE
bUxEE / woo_checkout_validation.js
Last active July 10, 2018 20:23
Woocommerce checkout validation with, mapbox autocmplete for address. must include mapbox sdk from cdn and jqueryvalidate
var mapboxEngine = new MapboxClient('MAPBOX_KEY');
function wopecko_validations() {
var $this = this;
this.init = function() {
this.rules();
this.checkout_validator();
this.find_address("#billing_address_1");
var pttable = $( '.dataTable' ).dataTable().api();
$('.posts-table-controls').first().append(
'<div class="datepicker-datatables" id="date_filter">' +
'<span id="date-label-from" class="date-label">Dal: </span><input class="date_range_filter date" type="text" id="datepicker_from" />' +
'<span id="date-label-to" class="date-label">Al: <input class="date_range_filter date" type="text" id="datepicker_to" />' +
'</div>'
);
$.fn.dataTable.ext.search.push(
function (settings, data, dataIndex) {
@bUxEE
bUxEE / elogp.php
Last active September 2, 2018 09:37
error_log
function elogp($var, $level="", $log="") {
$date = date("d-m-Y h:m:s");
$t = debug_backtrace();
$file = $t[0]['file'];
$level = $level == "" ? "info" : $level;
$log = $log == "" ? ABSPATH."/elogp.log" : $log;
$message = "[{$date}] [{$file}] [{$level}] ".print_r($var, true).PHP_EOL;
error_log($message, 3, $log);
}
@bUxEE
bUxEE / jquery-plugin-function.js
Created January 19, 2018 08:06
jquery plugin example
(function($) {
$.fn.extend({
myPlugin: function(options) {
var defaults = {
something: 23,
otherThing: 'hello'
};
options = $.extend(defaults, options);
<video controls width="100%" height="100%" preload="none" style="background-image:url('preview.jpg');">
<source src="video.mp4" type="video/mp4" />
<source src="video.webm" type="video/webm" />
<source src="video.ogg" type="video/ogg" />
<p>Il tuo browser non supporta questo video</p>
</video>
@bUxEE
bUxEE / htaccess-security.php
Created January 10, 2018 14:51
htaccess security settings
# START SECURITY
# Don't show errors which contain full path diclosure (FPD)
# Use that line only if PHP is installed as a module and not per CGI
# try using a php.ini in that case.
# Change mod_php5.c to mod_php7.c if you are running PHP7
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
# Don't list directories
@bUxEE
bUxEE / inputGroupJson.js
Last active December 14, 2017 23:21
grouped inputs to json
var group_fields = [];
// Loop through the fields
theForm.serializeArray().forEach(function(entry,i) {
// Get the index and prop name from the entry name
var nameparts = /^([a-zA-Z0-9_]+)\[(.+)\]\[(.*)\]$/.exec(entry.name);
// Get the group entry if we already have it
var group = group_fields[nameparts[2]];
if (!group) {
// We don't, create and add it
group = group_fields[nameparts[2]] = {};