Skip to content

Instantly share code, notes, and snippets.

View mhasan3's full-sized avatar
🎯
Focusing

Mahmudul Hasan mhasan3

🎯
Focusing
View GitHub Profile
@mhasan3
mhasan3 / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mhasan3
mhasan3 / gist:c7fd5935025582f1729a
Last active September 1, 2015 09:11 — forked from kitek/gist:1579117
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
<html>
<head>
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
</head>
<body>
<div id="map" style="height: 400px; width: 500px;">
</div>
<script type="text/javascript">
@mhasan3
mhasan3 / 01 - Theme Testing Process.markdown
Last active December 1, 2016 19:26 — forked from AlphaGit/01 - Theme Testing Process.markdown
Theme testing process (from Wordpress Codex)

Theme Testing Process

from Theme Development (Wordpress Codex)

  • Fix PHP and WordPress errors. Add the following debug setting to your wp-config.php file to see deprecated function calls and other WordPress-related errors: define('WP_DEBUG', true);. See Deprecated Functions Hook for more information.
  • Check template files against Template File Checklist.
  • Do a run-through using the Theme Unit Test.
  • Validate HTML and CSS. See Validating a Website.
  • Check for JavaScript errors.
  • Test in all your target browsers. For example, IE7, IE8, IE9, Safari, Chrome, Opera, and Firefox.
  • Clean up any extraneous comments, debug settings, or TODO items.
@mhasan3
mhasan3 / gist:1cee7fb21e76dd9bc9ea1b09ebfbf2df
Created October 15, 2016 17:32 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@mhasan3
mhasan3 / OrganizeFiles.sh
Created July 14, 2017 17:32 — forked from towfiqpiash/OrganizeFiles.sh
Run this shell script to organize files into separate folders
#!/bin/bash
folders='Compressed Documents Images Music Programs Videos'
ext_comp="*.zip *.tar.gz"
ext_doc="*.htm* *.php *.txt *.css *.doc* *.pdf *.PDF *.ppt* *.js"
ext_img="*.jp*g *.JPG *.png *.gif"
ext_music="*.mp3 *.aac *.wma"
ext_progrm="*.deb *.exe *.run"
ext_vid="*.mp4 *.mkv *.flv *.avi *.webm *.wmv"
@mhasan3
mhasan3 / class-tgm-plugin-activation.php
Created September 21, 2017 18:20 — forked from al5dy/class-tgm-plugin-activation.php
TGM 'Warning: sprintf(): Too few arguments...' bugfix
/**
* Sets install skin strings for each individual plugin.
*
* Checks to see if the automatic activation flag is set and uses the
* the proper strings accordingly.
*
* @since 2.2.0
*/
public function add_strings() {
if ( 'update' === $this->options['install_type'] ) {
@mhasan3
mhasan3 / repeatable-fields-metabox.php
Created November 17, 2017 12:31 — forked from helen/repeatable-fields-metabox.php
Repeating Custom Fields in a Metabox
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {
@mhasan3
mhasan3 / d8module.install
Created January 26, 2018 13:19 — forked from laradevitt/d8module.install
(Drupal 8) Create a table in a database other than the default during module installation. Database must already be specified in settings.php.
<?php
/**
* @file
* Install, update and uninstall functions for the d8module module.
*/
function d8module_schema_otherdb() {
$schema['mytable'] = array(
'description' => 'My table description',
@mhasan3
mhasan3 / delete-posts.sql
Created May 8, 2018 15:09 — forked from wpsmith/delete-posts.sql
SQL: Delete all posts of a custom post type with its associated meta data (taxonomies, post meta)
DELETE a,b,c
FROM {PREFIX}_posts a
LEFT JOIN {PREFIX}_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN {PREFIX}_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'POST_TYPE' AND a.post_date < '2014-01-01'