Skip to content

Instantly share code, notes, and snippets.

View shahzaibkhan's full-sized avatar

Shahzaib Khan shahzaibkhan

View GitHub Profile
@shahzaibkhan
shahzaibkhan / fix-to-iOS-iframe-height-issue.html
Created February 22, 2017 13:32 — forked from Mao8a/fix-to-iOS-iframe-height-issue.html
HTML: Fix to iOS iframe height issue
Fix to iOS iframe height issue
<iframe id="stupid-iframe" height="200" src="a-file.html"></iframe>
<html>
<body>
<div class="iframe-wrapper" style="width: 100%; height: 200px; overflow: auto; -webkit-overflow-scrolling: touch;">
</div>
</body>
<!doctype html>
<html class="iframe" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>TITLE</title>
<meta name="description" content="">
<meta name="author" content="">
@shahzaibkhan
shahzaibkhan / australian-postcodes.sql
Created July 13, 2017 12:36 — forked from randomecho/australian-postcodes.sql
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@shahzaibkhan
shahzaibkhan / woocommerce-custom-checkout-fields.php
Created March 8, 2021 11:35 — forked from psaikali/woocommerce-custom-checkout-fields.php
Add custom WooCommerce checkout fields, add an extra fee to the cart, validate the fields before processing the order and save them on the order metadata.
<?php
/**
* Plugin Name: WooCommerce Custom Checkout Fields
* Description: Add some custom "emergency level" extra fields on the WooCommerce Checkout page. Save this custom data in each order metadata.
* Author: Pierre Saïkali
* Author URI: https://saika.li
* Text Domain: wc_ccf
* Domain Path: /languages/
* Version: 1.0.0
* Full Tutorial: https://mosaika.fr/personnaliser-tunnel-commande-woocommerce/
@shahzaibkhan
shahzaibkhan / canvas-upload.php
Created March 12, 2021 08:52 — forked from fazlurr/canvas-upload.php
Function to save base64 image to png with PHP
<?php
// requires php5
define('UPLOAD_DIR', 'images/');
$img = $_POST['img'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
print $success ? $file : 'Unable to save the file.';
@shahzaibkhan
shahzaibkhan / custom-past-events.php
Created October 14, 2021 09:46 — forked from jo-snips/custom-past-events.php
The Events Calendar: Custom Query for Past Events
<?php
global $post;
$get_posts = tribe_get_events(array('posts_per_page'=>-1, 'eventDisplay'=>'past') );
foreach($get_posts as $post) { setup_postdata($post);
?>
<?php if ( has_post_thumbnail() ) { ?>
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
ID Year_Birth Education Marital_Status Income Kidhome Teenhome Dt_Customer Recency MntWines MntFruits MntMeatProducts MntFishProducts MntSweetProducts MntGoldProds NumDealsPurchases NumWebPurchases NumCatalogPurchases NumStorePurchases NumWebVisitsMonth AcceptedCmp3 AcceptedCmp4 AcceptedCmp5 AcceptedCmp1 AcceptedCmp2 Complain Z_CostContact Z_Revenue Response
5524 1957 Graduation Single 58138 0 0 04-09-2012 58 635 88 546 172 88 88 3 8 10 4 7 0 0 0 0 0 0 3 11 1
2174 1954 Graduation Single 46344 1 1 08-03-2014 38 11 1 6 2 1 6 2 1 1 2 5 0 0 0 0 0 0 3 11 0
4141 1965 Graduation Together 71613 0 0 21-08-2013 26 426 49 127 111 21 42 1 8 2 10 4 0 0 0 0 0 0 3 11 0
6182 1984 Graduation Together 26646 1 0 10-02-2014 26 11 4 20 10 3 5 2 2 0 4 6 0 0 0 0 0 0 3 11 0
5324 1981 PhD Married 58293 1 0 19-01-2014 94 173 43 118 46 27 15 5 5 3 6 5 0 0 0 0 0 0 3 11 0
7446 1967 Master Together 62513 0 1 09-09-2013 16 520 42 98 0 42 14 2 6 4 10 6 0 0 0 0 0 0 3 11 0
965 1971 Graduation Divorced 55635 0 1 13-11-2012 34 235 65 164 50 49
@shahzaibkhan
shahzaibkhan / nationality.html
Created June 20, 2022 06:05 — forked from didats/nationality.html
Nationality List in HTML Dropdown
<select name="nationality">
<option value="">-- select one --</option>
<option value="afghan">Afghan</option>
<option value="albanian">Albanian</option>
<option value="algerian">Algerian</option>
<option value="american">American</option>
<option value="andorran">Andorran</option>
<option value="angolan">Angolan</option>
<option value="antiguans">Antiguans</option>
<option value="argentinean">Argentinean</option>
export const nationalityList = [
'afghan',
'albanian',
'algerian',
'american',
'andorran',
'angolan',
'antiguans',
'argentinean',
'armenian',
@shahzaibkhan
shahzaibkhan / functions.php
Created June 30, 2022 04:58
Hide plugins from the WordPressAdmin plugin list
<?php
function plugin_hide() {
global $wp_list_table;
// replace your plugin url here
$hidearr = array('advanced-custom-fields/acf.php');
$myplugins = $wp_list_table->items;
foreach ($myplugins as $key => $val) {
if (in_array($key,$hidearr)) {
unset($wp_list_table->items[$key]);