Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
import 'package:shop_flutter_app/global_variables.dart';
import 'package:shop_flutter_app/widgets/product_card.dart';
import 'package:shop_flutter_app/pages/product_details_page.dart';
class ProductList extends StatefulWidget {
const ProductList({super.key});
@override
State<ProductList> createState() => _ProductListState();
@shayanabbas
shayanabbas / Import product to Shopify store using POST request to its API.md
Created January 11, 2024 22:07
Import product to Shopify store using POST request to its API

Posting product details to a Shopify store to create new products can be done using Shopify's API. As of 2023, Shopify provides a comprehensive API that allows you to interact with your store programmatically. Here's a step-by-step guide on how to do this:

Set Up a Shopify Private App:

Log in to your Shopify admin panel. Go to "Apps" and then choose "Manage private apps" (or similar, depending on the current Shopify layout). Create a new private app to obtain API credentials (API key and password) which are required for authentication.

Authentication:

@shayanabbas
shayanabbas / Import Products to WooCommerce using WordPress REST API.md
Created January 11, 2024 22:01
Import Products to WooCommerce using WordPress REST API

You can use the built-in WordPress REST API to import products into WooCommerce. WooCommerce extends the WordPress REST API with its own specific endpoints, allowing you to create, read, update, and delete products programmatically. Here's how you can do this:

Enable the WordPress REST API: Ensure that the WordPress REST API is enabled on your site. It is enabled by default in recent WordPress versions.

Authentication: To use the REST API, especially for writing data such as importing products, you'll need to authenticate. You can use one of the following methods:

Basic Authentication: This is simpler for development purposes but not recommended for production due to security concerns unless used over HTTPS. OAuth Authentication: More secure and suitable for production environments. Understand WooCommerce REST API Endpoints: WooCommerce adds several endpoints to the WordPress REST API for handling products. The endpoint for products typically looks like this: /wp-json/wc/v3/products.

@shayanabbas
shayanabbas / Extracting data from the Matomo Tracking API, processing it, translating it to a CSV file, and sending it daily via email.js
Created June 22, 2023 11:19
Make sure to replace the placeholders 'YOUR_MATOMO_SERVER', 'YOUR_SITE_ID', 'YOUR_AUTH_TOKEN', '[email protected]', '[email protected]', 'your_smtp_host', 'your_smtp_username', and 'your_smtp_password' with the actual values specific to your setup.
const fs = require('fs');
const request = require('request');
const csvWriter = require('csv-writer').createObjectCsvWriter;
const nodemailer = require('nodemailer');
// Matomo API endpoint and parameters
const apiUrl = 'https://your-matomo-server.com/matomo.php';
const siteId = 'YOUR_SITE_ID';
const tokenAuth = 'YOUR_AUTH_TOKEN';
const dateRange = 'previous30'; // Adjust the date range as needed
@shayanabbas
shayanabbas / How to Rename and Migrate WordPress Taxonomies Using WP-CLI
Last active June 15, 2023 13:29
The script provided below is a WP-CLI command script that renames the 'industry' taxonomy to 'segment' and migrates all terms and associated posts.
In our example, we're migrating the taxonomy 'industry' to a new taxonomy called 'segment'. Both these taxonomies are related to a custom post type 'case'.
myuser@Myuser-MacBook-Pro-Work mydummyproject % ddev debug test
Running bash [-c /var/folders/1p/_6dkh_gd1lv_nvpdxrv4jlw00000gn/T/test_ddev.sh]
OS Information: Darwin Myuser-MacBook-Pro-Work.local 22.0.0 Darwin Kernel Version 22.0.0: Mon Aug 1 06:31:07 PDT 2022; root:xnu-8792.0.207.0.6~26/RELEASE_X86_64 x86_64
ProductName: macOS
ProductVersion: 13.0
BuildVersion: 22A5321d
User information: uid=501(myuser) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae),701(com.apple.sharepoint.group.1)
DDEV version: ITEM VALUE
DDEV version v1.20.0
architecture amd64
myuser@Myuser-MacBook-Pro-Work mydummyproject % ddev logs
+ set -o errexit nounset pipefail
+ rm -f /tmp/healthy
+ DDEV_PHP_VERSION=7.4
+ DDEV_WEBSERVER_TYPE=apache-fpm
+ '[' -n 7.4 ']'
+ update-alternatives --set php /usr/bin/php7.4
+ ln -sf /usr/sbin/php-fpm7.4 /usr/sbin/php-fpm
+ export PHP_INI=/etc/php/7.4/fpm/php.ini
+ PHP_INI=/etc/php/7.4/fpm/php.ini
Running bash [-c /var/folders/1p/_6dkh_gd1lv_nvpdxrv4jlw00000gn/T/test_ddev.sh]
OS Information: Darwin My-MacBook-Pro-Work.local 22.0.0 Darwin Kernel Version 22.0.0: Mon Aug 1 06:31:07 PDT 2022; root:xnu-8792.0.207.0.6~26/RELEASE_X86_64 x86_64
ProductName: macOS
ProductVersion: 13.0
BuildVersion: 22A5321d
User information: uid=501(myuser) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae),701(com.apple.sharepoint.group.1)
DDEV version: ITEM VALUE
DDEV version v1.20.0
architecture amd64
db drud/ddev-dbserver-mariadb-10.4:v1.20.0
# We'll be installing Homebrew in the /opt directory.
cd /opt
# Create a directory for Homebrew. This requires root permissions.
sudo mkdir homebrew
# Make us the owner of the directory so that we no longer require root permissions.
sudo chown -R $(whoami) /opt/homebrew
# Download and unzip Homebrew. This command can be found at https://docs.brew.sh/Installation.
@shayanabbas
shayanabbas / Tietosuojaseloste
Created September 9, 2019 09:03
Tietosuojaseloste (Privacy Policy)
<p>Tämä seloste sisältää EU:n yleisen tietosuoja-asetuksen (2016/679) 13 ja 14 artiklan edellyttämiä tietoja henkilötiedoista, joita käsittelemme [DOMAIN]- verkkosivupalveluumme (jäljempänä ”<strong>Palvelu</strong>”) liittyen.</p>
<ol>
<li>
<p>Rekisterinpitäjä</p>
<p>[Yrityksen nimi]
<br /> Y-tunnus: [Yrityksen y-tunnus]
<br /> Osoite: [Yrityksen osoite]
<br /> Kotipaikka: Helsinki
<br />
<br />Yhteyshenkilö