Skip to content

Instantly share code, notes, and snippets.

@obiPlabon
obiPlabon / gist:32f8d6f8ed29b0054ea95a9f844ba08b
Created August 8, 2016 07:24 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
<?php
/*
Register Fonts
*/
function studio_fonts_url() {
$font_url = '';
/*
Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language.
@obiPlabon
obiPlabon / gist:b3adc3d871b1913b8572f49bcb2d1c86
Created April 7, 2016 12:46
regular expresstion to find out __ and _e but not esc_html__ or esc_attr_e etc...
[^\w]_[_|e]\(
@obiPlabon
obiPlabon / i18n.php
Created March 3, 2016 10:15
WordPress I18N Functions
<?php
__
_e
_ex
esc_attr__
esc_attr_e
esc_attr_x
esc_html__
esc_html_e
esc_html_x
@obiPlabon
obiPlabon / gist:218d0b744d78cabe3d26
Created February 8, 2016 08:26 — forked from bitfade/gist:4460948
WordPress 3.5 media upload api example
var workflow = wp.media({
title: 'Select the images',
// use multiple: false to disable multiple selection
multiple: 'add',
button: {
text: 'Add selected images'
},
library: {
type: 'image'
}
@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;
@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 / 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 );
#!/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