Skip to content

Instantly share code, notes, and snippets.

View techjewel's full-sized avatar
🎯
Focusing

Shahjahan Jewel techjewel

🎯
Focusing
View GitHub Profile
@techjewel
techjewel / WordPress_Jquery.php
Created November 12, 2013 01:05
change default source of jQuery in wordpress
<?php
function add_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery',
'//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js');
wp_enqueue_script( 'jquery' );
}
add_action('wp_enqueue_scripts', 'add_scripts');
@techjewel
techjewel / ubuntu_commands
Created December 6, 2013 22:13
Useful command line for Ubuntu
move/rename a folder: mv /home/user/oldname /home/user/newname
Delete a folder with files: rm -rf Folder_name
@techjewel
techjewel / simple-add-this.php
Last active December 31, 2015 02:29
This is a very simple code snippet to add social button as sortcode in wordpress
<?php
// paste this section in your functions.php
function j_add_this_social() {
return '<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_pinterest_pinit" pi:pinit:layout="horizontal"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
@techjewel
techjewel / grt_youtube_id_by_url.php
Created June 27, 2016 23:17
Get Youtube ID from Youtube Full URL
<?php
/***
*** @Get youtube video ID from url
***/
function get_youtube_id_from_url($url) {
$pattern =
'%^# Match any youtube URL
(?:https?://)? # Optional scheme. Either http or https
(?:www\.)? # Optional www subdomain
(?: # Group host alternatives
@techjewel
techjewel / equalChildHeights.js
Created December 3, 2016 14:06
Make Children divs as equal height with js
var doEqualHeights = function (parentNodeSelector, childNodeSelector) {
var $nodes = $(parentNodeSelector);
$.each($nodes, function (index,node) {
var children = $(node).find(childNodeSelector);
var childHeight = 0;
$.each(children, function (index, child) {
var currentHeight = $(child).height();
if(currentHeight > childHeight) {
childHeight = currentHeight;
@techjewel
techjewel / stripeCurrencies.php
Created July 20, 2017 06:44
Supported Stripe Currencies
<?php
/*
* Stripe Supported Currencies
* - JCB, Discover, and Diners Club cards can only be charged in USD
* - Currencies marked with * are not supported by American Express
* - Most alternative payment methods can only be used with a single currency
* - Brazilian Stripe accounts (currently in Preview) can only charge in Brazilian Real
* - Mexican Stripe accounts (currently in Preview) can only charge in Mexican Peso
* - Data from https://stripe.com/docs/currencies#charge-currencies
* - Last Update: July 20, 2017
@techjewel
techjewel / us_zip_cdes.json
Last active August 4, 2017 13:39
ZIP codes of USA in json format including city name, State, lat and long
[
{
"country": "US",
"zip": 34034,
"city": "APO",
"FIELD4": "",
"state": "AA",
"state_name": "Dillon",
"code": 33,
"FIELD8": "",
<?php
function addInlineVars($vars, $table_id) {
if(function_exists('wp_add_inline_script')) {
wp_add_inline_script( 'script_handle', 'window.ninja_footables.tables["table_'.$table_id.'"] = '.$vars.';');
} else {
add_action('wp_footer', function () use ($vars, $table_id) {
?>
<script type="text/javascript">
window.ninja_footables.tables["table_<?php echo $table_id;?>"] = <?php echo $vars ?>;
@techjewel
techjewel / scroll_to_top.js
Created March 21, 2018 08:12
Paging number click event and scroll to ninja tables beginning - WordPress Ninja Tables
/*
Change the offset value based on your theme. If you have fixed with header then you may need to increase the value
This code snippet only work on https://wordpress.org/plugins/ninja-tables/
*/
jQuery(document).ready(function() {
jQuery('table.ninja_footable').on('click', '.footable-page-link', function (e) {
var offset = 50;
jQuery('html, body').animate({
scrollTop: jQuery(this).closest('table.ninja_footable').offset().top - offset
<div id="footable_parent_353" class="ninja_table_wrapper">
<table class="ninja_table_pro">
<thead>
<tr class="footable-filtering">
<!-- Filtering Markup here -->
</tr>
<tr class="footable-header">
<th class="ninja_column_0">Column 1</th>
<th class="ninja_column_1">Another Column</th>
</tr>