Skip to content

Instantly share code, notes, and snippets.

View isheraz's full-sized avatar
:atom:

Sheraz Ahmed isheraz

:atom:
View GitHub Profile
@isheraz
isheraz / remove_checkout_fields.php
Created August 17, 2018 07:03 — forked from cryptexvinci/remove_checkout_fields.php
Remove fields from WooCommerce checkout page.
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
function custom_remove_woo_checkout_fields( $fields ) {
// remove billing fields
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
@isheraz
isheraz / .htaccess
Last active June 21, 2023 14:01
To Change Main directory to a subdirectory on a live website
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
@isheraz
isheraz / health_monit_device.py
Created July 5, 2018 13:59
Python Snippet to send vitals data
''' API CALL To SEND Data '''
import requests
class Client_Device(object):
BASE_URL = 'http://92.168.10.12:8000/api/' #change to your IP address as needed
def send_temperature(self, id, temperature):
url = self.BASE_URL + 'temperature' # Set destination URL here
post_fields = {'patient_id': id, 'temperature': temperature} # Set POST fields here
@isheraz
isheraz / eq_activity.java
Created May 17, 2018 09:31
Android Equalizer Activity Example for medium
package com.houseofdoyens.ultrahdplayer20;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.media.MediaPlayer;
# Single Perceptron
import decimal
import random
def randfloat():
decimal.getcontext().prec = 3 # 3decimal points enough
return decimal.Decimal(0) + decimal.Decimal(random.uniform(-1, 1))
@isheraz
isheraz / wp_port.sql
Last active October 16, 2017 07:48
wp_to port from local server on live server
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home';
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@isheraz
isheraz / _general.scss
Created April 11, 2017 13:32
A list of all general elements to be styled
body{
}
h1{
}
h2{
}
h3{
SELECT * FROM wp_posts p, wp_postmeta m1, wp_postmeta m2
WHERE p.ID = m1.post_id and p.ID = m2.post_id
AND m1.meta_key = 'key1' AND m1.meta_value = 'value1'
AND m2.meta_key = 'key2' AND m2.meta_value = "value2"