Skip to content

Instantly share code, notes, and snippets.

View itskawsar's full-sized avatar
🏠
Working from home

Kawsar Ahmad itskawsar

🏠
Working from home
  • Dhaka, Bangladesh
View GitHub Profile
@itskawsar
itskawsar / 2013_11_23_045123_create_divisions_table.php
Created August 26, 2021 03:50 — forked from shibbirweb/1ReadMe.md
Laravel Bangladesh GEO Locaiton Migration, Seeder, Model
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDivisionsTable extends Migration
{
/**
* Run the migrations.
<?php
/**
*
* You can find the complete tutorial for this here:
* https://pluginrepublic.com/woocommerce-custom-fields
*
* Alternatively, check out the plugin
* https://pluginrepublic.com/wordpress-plugins/woocommerce-product-add-ons-ultimate/
*
@itskawsar
itskawsar / curl-post.php
Created February 16, 2019 14:23 — forked from lesstif/curl-get.php
PHP CURL POST example
<?php
class Log {
public static function debug($str) {
print "DEBUG: " . $str . "\n";
}
public static function info($str) {
print "INFO: " . $str . "\n";
}
public static function error($str) {
@itskawsar
itskawsar / airports.sql
Created December 28, 2017 07:29 — forked from tanerdogan/airports.sql
airports.sql - airport list (total 8800 airport)
This file has been truncated, but you can view the full file.
DROP TABLE IF EXISTS `airports`;
CREATE TABLE IF NOT EXISTS `airports` (
`code` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL,
`name` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`cityCode` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL,
`cityName` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`countryName` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`countryCode` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL,
`timezone` varchar(8) COLLATE utf8_turkish_ci DEFAULT NULL,
@itskawsar
itskawsar / hosts
Created August 30, 2017 10:26 — forked from consti/hosts
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
// testing media uploader
add_action( 'admin_menu', 'register_media_selector_settings_page' );
function register_media_selector_settings_page() {
add_submenu_page( 'options-general.php', 'Media Selector', 'Media Selector', 'manage_options', 'media-selector', 'media_selector_settings_page_callback' );
}
add_action( 'admin_footer', 'media_selector_print_scripts' );
@itskawsar
itskawsar / openssl_encrypt_decrypt.php
Created January 30, 2017 12:09 — forked from joashp/openssl_encrypt_decrypt.php
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@itskawsar
itskawsar / gist:3213704a9c45fd1e7401b4d05c110d9d
Created January 30, 2017 12:09 — forked from niczak/gist:2501891
PHP Encrypt/Decrypt Class
<?php
class Encryption {
var $skey = "yourSecretKey"; // change this
public function safe_b64encode($string) {
$data = base64_encode($string);
$data = str_replace(array('+','/','='),array('-','_',''),$data);
return $data;
}
@itskawsar
itskawsar / seconds-human-redable-text.php
Created December 30, 2015 19:24
Seconds to human readable text
<?php
/*
* Convert seconds to human readable text.
* Found at: http://csl.sublevel3.org/php-secs-to-human-text/
*
*/
function secs_to_h($secs)
{
$units = array(
@itskawsar
itskawsar / gist:53b66273e43f1c007f08
Created December 10, 2015 14:23 — forked from MindyPostoff/gist:a10148daa110119b262f
Change "Proceed to PayPal" Text on Checkout Button in WooCommerce
/* Change the "Proceed to PayPal" button text in the WooCommerce checkout screen
* Add this to your theme's functions.php file
*/
add_filter( 'gettext', 'custom_paypal_button_text', 20, 3 );
function custom_paypal_button_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Proceed to PayPal' :
$translated_text = __( 'NEW BUTTON TEXT', 'woocommerce' );
break;
}