Skip to content

Instantly share code, notes, and snippets.

View hossinasaadi's full-sized avatar
🌍
Home

Hossin Asaadi hossinasaadi

🌍
Home
  • Amsterdam
View GitHub Profile
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@hossinasaadi
hossinasaadi / DataList.java
Last active September 12, 2020 10:31
save List as SharedPreferences Android
import java.util.List;
public class DataList {
List<Data> dataList;
public List<Data> getDataList() {
return dataList;
}
public void setDataList(List<Data> dataList) {
@hossinasaadi
hossinasaadi / mac-setup-redis.md
Created May 3, 2021 21:19 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@hossinasaadi
hossinasaadi / FileObserver on Android
Created July 29, 2021 18:07 — forked from shirou/FileObserver on Android
Detect file change using FileObserver on Android
private class PathFileObserver extends FileObserver{
static final String TAG="FILEOBSERVER";
/**
* should be end with File.separator
*/
String rootPath;
static final int mask = (FileObserver.CREATE |
FileObserver.DELETE |
FileObserver.DELETE_SELF |
FileObserver.MODIFY |
@hossinasaadi
hossinasaadi / echo-enqueued-styles-scripts-wordpress.php
Created January 9, 2022 17:05 — forked from omurphy27/echo-enqueued-styles-scripts-wordpress.php
Wordpress - Print Out All Enqueued Scripts And Styles On A Page
<?php
// add the below to your functions file
// then visit the page that you want to see
// the enqueued scripts and stylesheets for
function se_inspect_styles() {
global $wp_styles;
echo "<h2>Enqueued CSS Stylesheets</h2><ul>";
foreach( $wp_styles->queue as $handle ) :
echo "<li>" . $handle . "</li>";
@hossinasaadi
hossinasaadi / README.md
Created January 19, 2022 14:09 — forked from Lazza/README.md
VPNGate Python script

vpngate.py

This script allows to use the free VPN service provided by VPNGate in an easy way. The user just needs to provide the desidered output country, and the script automatically chooses the best server.

After this step, OpenVPN is launched with the proper configuration. The VPN can be terminated by pressing Ctrl+C.

Usage

Run the script by providing the desired output country:

@hossinasaadi
hossinasaadi / source_address_requests.py
Created January 19, 2022 15:15
Bind IP to requests library python
# bind source_address to requests
import urllib3
real_create_conn = urllib3.util.connection.create_connection
def set_src_addr(address, timeout, *args, **kw):
source_address = ('YOUR_BIND_IP', 0)
return real_create_conn(address, timeout=timeout, source_address=source_address)
urllib3.util.connection.create_connection = set_src_addr
@hossinasaadi
hossinasaadi / SignInView.swift
Created July 13, 2022 10:54 — forked from jbnunn/SignInView.swift
SwiftUI + PhoneNumberKit implementation
import SwiftUI
import UIKit
import PhoneNumberKit
struct PhoneNumberTextFieldView: UIViewRepresentable {
@Binding var phoneNumber: String
private let textField = PhoneNumberTextField()
func makeUIView(context: Context) -> PhoneNumberTextField {
textField.withExamplePlaceholder = true
Platform CPU GOOS GARCH GOARM SDK CGO_FLAGS CARCH
Windows x86_64 windows amd64 x86_64
Windows x86_32 windows 386 x86_32
MacOS x86_64 darwin amd64 macos x86_64
MacOS M1 darwin arm64 macos arm64
Linux x86_64 linux amd64 x86_64
Linux x86_32 linux 386 x86_32
Linux arm64 linux arm64 arm64
iOS Simulator x86_64 darwin amd64 iphonesimulator -fembed-bitcode x86_64
iOS arm darwin arm64 iphoneos -fembed-bitcode arm64
@hossinasaadi
hossinasaadi / Packet.swift
Created July 20, 2023 18:12 — forked from Taher-17/Packet.swift
PacketTunnel Provider
//
// PacketTunnelProvider.swift
// Shadowsocks
//
// Created by Taher Ismail on 19/03/19.
// Copyright © 2019 Taher Ismail. All rights reserved.
//
import NetworkExtension
import NEKit