Skip to content

Instantly share code, notes, and snippets.

View obiPlabon's full-sized avatar
🎯
1 goal

Md Obidullah obiPlabon

🎯
1 goal
View GitHub Profile
<?php
/**
* Template Name: Assets
*/
$js_dir = dirname( __FILE__ ) . '/assets/js/';
$css_dir = dirname( __FILE__ ) . '/assets/css/';
$js = $js_dir . '*.js';
$css = $css_dir . '*.css';
$register = array();
$enqueue = array();
@obiPlabon
obiPlabon / wp-load-template.php
Last active October 22, 2015 19:50
Built in function and it's pretty helpful to understand WP global variable
<?php
function load_template( $_template_file, $require_once = true ) {
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
if ( is_array( $wp_query->query_vars ) ) {
extract( $wp_query->query_vars, EXTR_SKIP );
}
if ( isset( $s ) ) {
$s = esc_attr( $s );
@obiPlabon
obiPlabon / .csscomb.json
Created November 3, 2015 18:33
CSS comb config
{
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": false,
"quotes": "double",
@obiPlabon
obiPlabon / frontendDevlopmentBookmarks.md
Created November 6, 2015 19:47 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@obiPlabon
obiPlabon / mdd.js
Created December 23, 2015 06:35
Matrix diagonal difference
function matrixDiagDiff(m) {
var d1 = d2 = 0;
for(var i = 0, l = m.length; i < l; i++){
d1 += m[i][i];
d2 += m[i][l-(i+1)];
}
console.log(d1-d2);
}
@obiPlabon
obiPlabon / mpd.js
Created December 23, 2015 06:48
Matrix plus diff
function matrixPlusDiff(m) {
var d1 = d2 = 0;
for(var i = 0, l = m.length; i < l; i++){
d1 += m[i][Math.floor(l/2)];
d2 += m[Math.floor(l/2)][i];
}
console.log(d1-d2);
}
#!/bin/bash
hostName=$1
echo "$hostName creation procedure starts"
# create directory at /var/www/
sudo mkdir /var/www/$hostName
# goto apache dirctory
cd /etc/apache2/sites-available
@obiPlabon
obiPlabon / char-frequency.js
Last active January 1, 2016 17:20
Find out charecter frequency
// case insensetive
function countLetterFrequency(str) {
var a = str.toLowerCase().split('').sort(),
o = {},
char = [];
while(a.length) {
char = a.slice(0, a.lastIndexOf( a[0] ) + 1 );
o[char[0]] = char.length;
a = a.slice( a.lastIndexOf( a[0] ) + 1 );
@obiPlabon
obiPlabon / gist:361215d441a2a04b8091
Created February 8, 2016 08:24 — forked from bitfade/gist:ee91d7e8aff16364b9ff
Custom WordPress Media Uploader
(function ($) {
"use strict";
/*global wp,jQuery */
var CustomGalleryEdit,CustomFrame;
function customClasses() {
var media = wp.media;
var l10n = media.view.l10n;
@obiPlabon
obiPlabon / filter.js
Created February 8, 2016 08:25 — forked from bitfade/filter.js
WordPress 3.5 media upload, toolbar with custom filter
/*jslint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false, nomen: false */
/*global wp,jQuery */
jQuery(document).ready(function($) {
if (!window.wp || !window.wp.media) {
return;
}
var media = window.wp.media;