Skip to content

Instantly share code, notes, and snippets.

View zakirsajib's full-sized avatar
💭
Looking for a new challenge in 2022!

Zakir Sajib zakirsajib

💭
Looking for a new challenge in 2022!
View GitHub Profile
@zakirsajib
zakirsajib / gist:210f8774ea99eab7e081ba894c344851
Created March 1, 2018 11:24
Facebook, Instagram and Pinterest hover ACTUAL color
a.fb:hover {
color: #3B5998;
}
a.inst:hover {
color: #fb3958;
}
a.pin:hover {
color: #C92228;
}
@zakirsajib
zakirsajib / Add New File to WordPress plugin repository via SVN
Last active June 22, 2018 07:31
WordPress Plugin file add/update/commit via SVN
# To add a new screenshot
## First cd to directory and then type
svn add assets/screenshot-5.jpg
# and now commit
svn ci -m "added new screenshot for user profile" assets/screenshot-5.jpg
@zakirsajib
zakirsajib / CSS
Created May 25, 2018 06:17
Parallax Background Image in IOS devices
.parallax-section {
position: relative;
width: 100%;
height:700px;
}
.parallax-child-section {
clip: rect(0, auto, auto, 0);
position: absolute;
top: 0;
left: 0;
@zakirsajib
zakirsajib / functions.php
Created January 23, 2019 05:12
Defer customers to login if they are inactive or cancelled their memberships. But Admin can login.
add_filter( 'authenticate', 'chk_active_user',100,2);
function chk_active_user ($user, $password) {
$user_data = $user->data;
$user_id = $user_data->ID;
if(is_super_admin($user_id)) {
add_filter('authenticate', 'wp_authenticate_username_password', 20);
//add_filter( 'authenticate', 'wp_authenticate_email_password', 20, 3 );
//add_filter( 'authenticate', 'wp_authenticate_spam_check', 99 );
<?php
// Complete the repeatedString function below.
function repeatedString($s, $n) {
$find_a = substr_count($s, "a");
if($find_a > 1 && $n < 100000000000){
$total_repeated_string = str_repeat($s, $n);
$actual_string = substr($total_repeated_string, 0, $n);
@zakirsajib
zakirsajib / Respository.js
Created January 28, 2020 11:05
GitHub GraphQL query component
import React from 'react'
import {useStaticQuery, graphql} from 'gatsby'
const Repository = () => {
let imgAray = ['prj-01', 'prj-01', 'prj-03', 'prj-04', 'prj-05'];
let images = imgAray.map(image => {
return <img key={image} src={require(`../images/uploads/portfolio/${image}.jpg`)} alt="" />
@zakirsajib
zakirsajib / gatsby-config.js
Created January 28, 2020 11:08
Gatsby Source GitHub
{
resolve: 'gatsby-source-github',
options: {
headers: {
Authorization: `Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`,
},
queries: [
`{
viewer {
pinnedItems(first: 50, types: REPOSITORY) {
@zakirsajib
zakirsajib / functions.php
Created February 5, 2020 06:19
Add featured thumbnail to admin post columns
if ( function_exists( 'add_theme_support' ) ) {
add_filter( 'manage_posts_columns' , 'frontlash_add_custom_columns' );
add_action( 'manage_posts_custom_column' , 'frontlash_add_thumbnail_columns_data', 10, 2 );
add_action( 'manage_posts_custom_column' , 'frontlash_add_modified_author_columns_data', 10, 2 );
}
function frontlash_add_custom_columns( $columns ) {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Title',
@zakirsajib
zakirsajib / functions.php
Last active March 7, 2020 08:37
Timeline based Custom post type and required styles
add_action( 'wp_enqueue_scripts', 'mears_scripts');
function mears_scripts(){
wp_enqueue_script( 'mears-infinite-scroll', get_stylesheet_directory_uri() . '/vendor/infinite-scroll/infinite-scroll.pkgd.min.js', array('jquery'), null, true );
wp_enqueue_script( 'mears-history', get_stylesheet_directory_uri() . '/js/custom.js', array('jquery'), null, true );
}
@zakirsajib
zakirsajib / gist:4a6c66db54ccb3a97050ed899fed22c2
Last active May 17, 2020 05:29
Implement a function distinct(...), which expects an array of integers and sorts these ascendingly. The array shall not contain repetitions of any integer value but '1'. Repetitions of '1' should be the last values of the array.
<?php
function distinct($input){
$result = array_unique($input);
sort($result);
$key = array_search(1, $result);
if(false !== $key):
array_push($result, 1);
endif;
print_r($result);