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
diff -ru readykommerce-multi-newsletter-signup-light-orig/nl_signup.php readykommerce-multi-newsletter-signup-light/nl_signup.php
--- readykommerce-multi-newsletter-signup-light-orig/nl_signup.php 2014-02-13 09:40:23.000000000 -0500
+++ readykommerce-multi-newsletter-signup-light/nl_signup.php 2014-03-12 12:58:08.000000000 -0400
@@ -278,13 +278,13 @@
// If is the home page, an archive, or search results
if(is_front_page() || is_archive() || is_search() || is_single() || is_page()) :
global $post;
- // $content = $post->post_excerpt;
+
$file = get_post_meta( $post->ID, 'nl_file_upload', true );
@itskawsar
itskawsar / PHP array of Country Names
Last active August 29, 2015 14:02
PHP array of Country Names
<?php
$countries = array(
"Afghanistan",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
@itskawsar
itskawsar / WordPress Custom Metabox Snippet
Created June 24, 2014 11:35
WordPress Custom Metabox Snippet
// Product meta box
/**
* Adds a box to the main column on the Post and Page edit screens.
*/
function tormuz_add_meta_box() {
$screens = array( 'product' );
foreach ( $screens as $screen ) {
@itskawsar
itskawsar / designer.html
Created August 20, 2014 18:02
designer
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-directions.html">
<link rel="import" href="../yt-video/yt-search-video.html">
<polymer-element name="my-element">
<template>
<style>
:host {
<?php
#!/usr/bin/env php
//usage: php envato-screenshots-downloader.php /path/to/save/screenshots http://url/to/screenshots/page
set_time_limit(0);
$dir = $argv[1];
$source = $argv[2];
print_r($argv);
mkdir ($dir);
$src = file_get_contents($source);
$pattern = '/src="(https:\/\/0.s3[a-zA-Z0-9_\-\.\/%]+)"/i';
@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;
}
@itskawsar
itskawsar / get_current_location.html
Last active December 26, 2015 01:19
HTML 5 - Pointing current position in google map using GeoLocation API
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
</head>
<body style="font: 75% Lucida Grande, Trebuchet MS;margin:0">
<div id="content" style="height: 450px"></div>
<script>
@itskawsar
itskawsar / .htaccess
Created November 23, 2013 21:36
HTML 5 boilerplate gZip compression is not working
RewriteEngine On
#This rewrites your host name to include www
RewriteCond %{HTTP_HOST} !^www\.clippingpathfamily\.com [NC]
RewriteRule ^(.*)$ http://www.clippingpathfamily.com/$1 [R=301,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
### redirect 301
RewriteCond %{THE_REQUEST} ^.*/index\.php
@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(