Skip to content

Instantly share code, notes, and snippets.

View coder618's full-sized avatar
🎯
Focusing

Ahadul Islam coder618

🎯
Focusing
View GitHub Profile
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
@coder618
coder618 / add Mailchimp email address by CURL
Created May 26, 2020 12:23
Mailchimp Add E-Email Address CURL PHP
<?php
// require 'auth.php';
$username = 'username';
$password = 'password';
$url = 'https://us19.api.mailchimp.com';
// $postvars = "email_address=tiktok@boom.com&status=subscribed";
$postvars = [
"email_address"=> "azizulla@yahoo.com",
"status"=> "subscribed",
"merge_fields" => [
/**
* This function will return array start and end index
* which can be use in array slice Method
* @param {int} pageNumber
* @param {int} posts_per_page
* Logic Behind it
* 5
0 0 5
1 5 10
2 10 15
@coder618
coder618 / Render Posts Post template Function
Last active December 7, 2019 02:58
Render Posts , template for: post type
// following function will be use when you apply this shortcode: [render-posts type="post"]
function post_template($id){
$c_id = $id;
$post_img_url = get_the_post_thumbnail_url($c_id, 'large');
$title = esc_html(get_the_title($c_id));
$html = '';
$html .= '<a href="'.get_permalink($c_id).'" class="default-post-template">';
if($post_img_url):
$html .= '<img src="'.$post_img_url.'" alt="'.$title.'">';
endif;
@coder618
coder618 / phpmyadmin fix
Last active August 16, 2019 12:31
phpmyadmin problem in php7.2
/**
* Function to check whether to remember the sorting order or not
*
* @param array $analyzed_sql_results the analyzed query and other variables set
* after analyzing the query
*
* @return boolean
*/
function PMA_isRememberSortingOrder($analyzed_sql_results)
{
@coder618
coder618 / django-json-example.py
Created August 14, 2019 04:49 — forked from cspanring/django-json-example.py
Basic example for iterating over a Django queryset and returning JSON objects.
import json
from .models import MyModel
def get_json(request):
# Return JSON for filtered MyModel objects
records = MyModel.objects.filter(myproperty=myvalue)
wait_timeout=28800
interactive_timeout = 28800
post_max_size = 800M
upload_max_filesize = 800M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
@coder618
coder618 / Mobile Navigation
Last active December 22, 2018 06:18
Mobile navigation
/* JS */
$("li.menu-item-has-children > a").on("click", function(e){
e.preventDefault();
var c_item = $(this).siblings('ul')
c_item.toggleClass("d-block")
})
/* MOBILE SCSS */
.main-nav-mobile-container{
@coder618
coder618 / gist:ab3aa141d7291379ffa3b9726049a989
Created October 26, 2018 05:27 — forked from hissy/gist:7352933
[WordPress] Add file to media library programmatically
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@coder618
coder618 / timer
Created October 11, 2018 03:18
js timer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>time</title>
</head>
<style>
h2{