Skip to content

Instantly share code, notes, and snippets.

View pauloiankoski's full-sized avatar

Paulo Iankoski pauloiankoski

View GitHub Profile
@pauloiankoski
pauloiankoski / myProfit.js
Last active May 1, 2024 20:44
UserScript for myProfit
// ==UserScript==
// @name myProfit
// @version 1.11.6
// @namespace https://gist.github.com/pauloiankoski/2fbaf199904c24369f60a51e5f3935e8/
// @description This script will add new columns to the AssetDetail page to report the total result including provents.
// @author pauloiankoski / prcvilla
// @match https://myprofitweb.com/App/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=myprofitweb.com
// @grant none
// ==/UserScript==
@pauloiankoski
pauloiankoski / functions.php
Last active July 22, 2022 13:21
console.log() PHP variables
<?php
if ( ! function_exists( 'console_log' ) ) {
function console_log( $var ) {
$backtrace = debug_backtrace();
$log[] = sprintf(
'"DEBUG: On %s at line %d:"',
str_replace( $_SERVER['DOCUMENT_ROOT'], '', $backtrace[0]['file'] ),
$backtrace[0]['line']
);
$log[] = sprintf( '"(%s)"', gettype( $var ) );
@pauloiankoski
pauloiankoski / Cached build commands
Created November 7, 2019 12:41
DeployBot settings
# refresh: package.json
nvm install 10.16.3
nvm use
npm i -g gulp-cli
npm install
npm rebuild node-sass
jQuery(document).ready(function($)) {
var preventSubmit = true
$('.acf-field[data-name="repeater_value"]').hide()
$('.wp-admin.post-type-page form#post').on('submit', function(e) {
if ( ! preventSubmit ) {
return
}
@pauloiankoski
pauloiankoski / examples.js
Last active April 6, 2017 14:10
Single gulpfile.js to compile SASS and minify JS on multiples folders on a WordPress project.
gulp // Compile all files from all folders
gulp css // Compile all SASS files from all folders
gulp js // Minify all JS files from all folders
gulp --plugin1 // Compile all files from plugin1 folder
gulp css --plugin1 // Compile all SASS files from plugin1 folder
gulp js --plugin1 // Minify all JS files from plugin1 folder
gulp --plugin1 --theme1 // Compile all files from plugin1 and theme1 folders
gulp css --plugin1 --theme1 // Compile all SASS files from plugin1 and theme1 folders
@pauloiankoski
pauloiankoski / class-wc-af-score-helper.php
Created July 7, 2016 17:52
Fix disable Cancel Score and Hold Score on Anti Fraud plugin.
if ( $score_points < $cancel_score && $cancel_score < 100 ) {
$new_status = 'wc-cancelled';
} elseif ( $score_points < $hold_score && $hold_score < 100 ) {
$new_status = 'wc-on-hold';
}
@pauloiankoski
pauloiankoski / gist:78a94ae0c11ad15dac9c
Created January 14, 2016 00:00
WooCommerce Ajax Cart Update
jQuery(document).ready(function($){
var woocommerce_form = $( '.woocommerce-cart form' );
woocommerce_form.on('change', '.qty', function(){
form = $(this).closest('form');
// emulates button Update cart click
$("<input type='hidden' name='update_cart' id='update_cart' value='1'>").appendTo(form);
// get the form data before disable button...
formData = form.serialize();
@pauloiankoski
pauloiankoski / layout.scss
Created October 9, 2015 13:39
Banner padrão
.metaslider {
.ms-image {
background-position : center center !important;
background-size : cover !important;
height : 500px;
}
}
@pauloiankoski
pauloiankoski / page-redirect_to_child.php
Created August 10, 2015 12:32
Template que redireciona para página filha
<?php
/*
* Template Name: que redireciona para filho
*/
$child_page = get_pages( "child_of=" . $post->ID . "&sort_column=menu_order" );
if ( $child_page ) {
$firstchild = $child_page[0];
wp_redirect( get_permalink( $firstchild->ID ) );
exit;
}
@pauloiankoski
pauloiankoski / header.php
Created August 7, 2015 02:41
Video background
<?php
if ( is_front_page() ) :
?>
<div class="video-container">
<video autoplay loop poster="polina.jpg">
<source src="<?php vulcano_images( 'bg-video.webm' ); ?>" type="video/webm">
<source src="<?php vulcano_images( 'bg-video.mp4' ); ?>" type="video/mp4">
</video>
</div>
<?php