Skip to content

Instantly share code, notes, and snippets.

View ventouris's full-sized avatar

Tasos Ventouris ventouris

  • Greece
View GitHub Profile
@ventouris
ventouris / json
Created January 13, 2022 14:31
Data Scientist skills
{
"success": true,
"message": "",
"result": {
"id": 3413,
"name": "data scientist",
"description": "People in this job find and interpret rich data sources, manage large amounts of data, merge data sources, ensure consistency of data-sets, and create visualisations to aid in understanding data. They build mathematical models using data, present and communicate data insights and findings to specialists and scientists in their team and if required, to a non-expert audience, and recommend ways to apply the data. They utilise recommendation engines, spam classifiers, sentiment analysers and classifiers for unstructured and semi-structured data.",
"status": "active",
"type": "platform",
"attributes": [],
/*
* Adjust the interval that the feed file is generated.
*/
function sv_wc_facebook_feed_generation_interval( $interval ) {
// return the time in seconds that the interval should run e.g. 180 minutes:
return 60 * 180;
}
add_filter( 'wc_facebook_feed_generation_interval', 'sv_wc_facebook_feed_generation_interval', 10, 1 );
function tracking_company_select_options() {
return array(
'elta' => 'Ελτά',
'tnt' => 'TNT',
'geniki_taxydromiki' => 'Γενική Ταχυδρομική'
);
}
add_action( 'cmb2_admin_init', 'dcwd_order_metabox' );
function dcwd_order_metabox() {
{
"contributors": null,
"coordinates": null,
"created_at": "Tue May 21 05:59:29 +0000 2019",
"display_text_range": [
0,
140
],
"entities": {
"hashtags": [],
-- Remove all attributes from WooCommerce
DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%');
DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%';
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);
-- Delete all WooCommerce products
DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');
-- Delete orphaned postmeta
DELETE pm
@ventouris
ventouris / functions.php
Created April 14, 2018 08:48
Free Shipping message for Woocommerce
function free_shipping_cart_notice() {
$min_amount = 100;
// Subtotal inc. Tax excl. Shipping
$current = WC()->cart->subtotal;
if ( $current < $min_amount ) {
$added_text = esc_html__('You will have FREE shipping if you add ', 'woocommerce' ) . wc_price( $min_amount - $current ) . esc_html__(' more in your order!', 'woocommerce' );
$return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
@ventouris
ventouris / delete-all-woocommerce-products.php
Created October 30, 2017 09:37 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
@ventouris
ventouris / woo_update.php
Last active April 3, 2020 16:04
Add variation products programmatically on Woo
//The array has this format
//[
// {
// "name" : "T-Shirt",
// "available_attributes": [
// "size", "color"
// ],
// "variations":
// [
@ventouris
ventouris / js
Created September 5, 2017 12:23
Webpack production js
const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev
/**
* Webpack Plugins
*/
//const DedupePlugin = require('webpack/lib/optimize/DedupePlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const IgnorePlugin = require('webpack/lib/IgnorePlugin');
getTransportations() {
let loader = this.loadingController.create({
content: 'Getting data...'
});
loader.present();
return this.wpApi.getTransportations(this.maxResults)
.then( (data) => {
if ( data.status == 200 ) {
this.transportantions = data.response.entries;
} else {