Skip to content

Instantly share code, notes, and snippets.

Tusko Trush Tusko

Block or report user

Report or block Tusko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Tusko
Tusko / router.async.js
Created Feb 9, 2020
Vue Router async push method
View router.async.js
const router = new VueRouter({
mode: "history",
base: process.env.BASE_URL,
routes
});
/**
* Async push method
*/
router.pushAsync = function(route) {
@Tusko
Tusko / query.sql
Created Dec 1, 2019
Bulk move posts to Woocommerce
View query.sql
//backup your dabatase at first
UPDATE `wp_posts` SET `post_type` = 'product' WHERE post_type = 'post';
UPDATE `wp_term_taxonomy` SET `taxonomy` = 'product_cat' WHERE `taxonomy` = 'category'
@Tusko
Tusko / cpt.php
Created Nov 9, 2019
Remove slug from Custom Post Type in Wordpress
View cpt.php
<?php
/*
*** You van use dash-icons https://developer.wordpress.org/resource/dashicons/
*/
add_action( 'init', 'register_cpts' );
function register_cpts() {
register_post_type( 'services',
array(
'labels' => array(
@Tusko
Tusko / refs.$parent.js
Created Oct 2, 2019
get parent component refs VUE
View refs.$parent.js
export default {
mounted () {
let profile = this.$parent
let flag = false
while (!flag) {
if (has(profile.$refs, 'profileScroll')) {
flag = true
} else {
profile = profile.$parent
@Tusko
Tusko / mail_regex.js
Created Jul 7, 2019
Email Regex 2019
View mail_regex.js
var mail_valid = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;
/* Example */
var inputField = $('input[type="email"]');
if( mail_valid.test(inputField.val().toLowerCase()) ) {
inputField.parent().addClass('mail-valid');
} else {
inputField.parent().removeClass('mail-valid');
}
@Tusko
Tusko / func.php
Created Dec 6, 2018
Disable Wordperss Update to major 5.0 | Downgrade wordpress to 4.9.8
View func.php
<?php
add_filter('pre_site_option_update_core','wpdg_specific_version' );
add_filter('site_transient_update_core','wpdg_specific_version' );
function wpdg_specific_version($updates){
$sprache = get_locale().'/';
if ($sprache == 'en_US/' OR $sprache == 'en'){
$sprache = '';
};
$dg_version = '4.9.8';
@Tusko
Tusko / func.php
Created Oct 24, 2018
Set random dates for events ACF/WP
View func.php
<?php
$allevents = wp_get_recent_posts(array(
'showposts' => '-1',
'post_type' => 'events'
));
$start = strtotime("10 October 2018");
//End point of our date range.
$end = strtotime("22 November 2020");
@Tusko
Tusko / dom-helper.js
Created Oct 16, 2018 — forked from LasMD/dom-helper.js
Mini jQuery, sort of.
View dom-helper.js
/**
* A collection of helper prototype for everyday DOM traversal, manipulation,
* and event binding. Sort of a minimalist jQuery, mainly for demonstration
* purposes. MIT @ m3g4p0p
*/
window.$ = (function (undefined) {
/**
* Duration constants
* @type {Object}
View acf-cpt-custom.php
<?php
function ex_project_archive_options($cptmenu) {
$cptmenu['page_title'] = 'Projects Archive';
$cptmenu['menu_title'] = 'Projects Archive';
$cptmenu['slug'] = 'my-projects-archive';
return $cptmenu;
}
add_filter('cpt_project_acf_page_args', 'ex_project_archive_options');
/*
@Tusko
Tusko / style_basic.css
Created Jun 7, 2018
Wordpress Taxonomy Tree
View style_basic.css
.is-current-cat {
color: red !important
}
.cat-parent > li > ul {
padding-left: 20px;
display: none
}
.cat-parent > li > .is-current-cat + ul {
display: block
}
You can’t perform that action at this time.