This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//storing the card number in session just for testing, in real, it will be saved in database. | |
session_start(); | |
if(isset($_POST['submit'])){ | |
$string = str_replace(' ', '', $_POST['card']); | |
$_SESSION['card'] = $string; | |
} | |
echo $_SESSION['card']; | |
?> | |
<html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<ul id="list"></ul> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adding Metabox for adding a checkbox to hide or unhide the page title | |
*/ | |
function fay_add_meta_box_for_page_title_display() | |
{ | |
add_meta_box( 'fay-meta-box-for-page-title', 'Page Title', 'fay_add_meta_box_for_page_title_display_callback', 'page', 'side', 'high' ); | |
} | |
add_action( 'add_meta_boxes', 'fay_add_meta_box_for_page_title_display' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = "https://www.aliexpress.com/store/product/GGMM-E5-WiFi-Wireless-Speakers-Bluetooth-Receiver-Portable-MP3-Player-Stereo-Hands-free-Call-HiFi-Speaker/602731_32776280965.html?spm=2114.12010612.0.0.GaXHNJ"; | |
$name = 'e5'; | |
$oldmask = umask(0); | |
mkdir('/home/faysal/Downloads/aliexpress/'.$name, 0777); | |
$output = file_get_contents($url); | |
preg_match_all('/([-a-z0-9_\/:.]+\.(jpg))/i', $output, $url_matches); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://computerandu.wordpress.com/2011/06/29/how-to-get-google-invite/'; | |
$emails = scrape_email($url); | |
echo implode($emails, ' '); | |
function scrape_email($url) { | |
if ( !is_string($url) ) { | |
return ''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//<input onchange="previewFile('#logo_preview', '#logo')" id="logo" type="file" name="logo"> | |
//<img id="logo_preview" src=""> | |
function previewFile(preview, source) { | |
var preview = document.querySelector(preview); | |
var file = document.querySelector(source).files[0]; | |
var reader = new FileReader(); | |
reader.onloadend = function () { | |
preview.src = reader.result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_title($title_parts) { | |
if ( is_search() ) { | |
$title_parts['title'] = get_search_query(); | |
} | |
return $title_parts; | |
} | |
add_filter( 'document_title_parts', 'custom_title' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "./node_modules/tailwindcss/base"; | |
@import "./node_modules/tailwindcss/components"; | |
@import "./node_modules/tailwindcss/utilities"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Converts CSV to JSON | |
* Example uses the csv file of this gist | |
*/ | |
$feed="https://gist.githubusercontent.com/devfaysal/9143ca22afcbf252d521f5bf2bdc6194/raw/ec46f6c2017325345e7df2483d8829231049bce8/data.csv"; | |
//Read the csv and return as array | |
$data = array_map('str_getcsv', file($feed)); | |
//Get the first raw as the key | |
$keys = array_shift($data); |
OlderNewer