Skip to content

Instantly share code, notes, and snippets.

View accessomnath's full-sized avatar
🎯
Focusing

Somnath Mondal accessomnath

🎯
Focusing
View GitHub Profile
@accessomnath
accessomnath / vcpage.php
Created May 15, 2018 10:20
Fetching vc styles with content
<?php
Vc_Manager::getInstance()->vc()->addShortcodesCustomCss($page_id);
$the_post = get_post($page_id);
echo apply_filters('the_content', $the_post->post_content);
?>
@accessomnath
accessomnath / FOR ACTIVE CLASS IN WORDPRESS
Created February 20, 2018 12:43
FOR ACTIVE CLASS IN WORDPRESS
function special_nav_class ($classes, $item) {
if (in_array('current-menu-item', $classes) ){
$classes[] = 'active ';
}
return $classes;
}
@accessomnath
accessomnath / scroll.js
Created February 7, 2018 14:11
When you are doing some crazy thing to your menus
// lock scroll position, but retain settings for later
var scrollPosition = [
self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
];
var html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that
html.data('scroll-position', scrollPosition);
html.data('previous-overflow', html.css('overflow'));
html.css('overflow', 'hidden');
window.scrollTo(scrollPosition[0], scrollPosition[1]);
@accessomnath
accessomnath / .htaccess
Created February 6, 2018 12:32
Custom php with ssl htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
du -sh /var/cache/apt/archives
//clean the apt cache
sudo apt-get clean
//way to remove old kernels in Ubuntu
sudo apt-get autoremove --purge
//To remove a specific app by name
sudo apt-get remove package-name1 package-name2
//packages and dependencies which are newer versions have replaced them
sudo apt-get autoremove
@accessomnath
accessomnath / node_js
Created February 3, 2018 18:58
node js 404 error..
sudo add-apt-repository -y -r ppa:chris-lea/node.js
sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list
@accessomnath
accessomnath / function for convert value
Created December 29, 2017 14:19
function for convert value
function getIndianCurrency(float $number)
{
$decimal = round($number - ($no = floor($number)), 2) * 100;
$hundred = null;
$digits_length = strlen($no);
$i = 0;
$str = array();
$words = array(0 => '', 1 => 'one', 2 => 'two',
3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six',
7 => 'seven', 8 => 'eight', 9 => 'nine',
@accessomnath
accessomnath / pass
Created December 3, 2017 20:33
pass
dd@32@ata
@accessomnath
accessomnath / up-to date node package manager
Created December 3, 2017 18:00
upgrading npm package
sudo npm install npm@latest -g
@accessomnath
accessomnath / administration directory
Created December 3, 2017 17:44
I Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
sudo fuser -vki /var/lib/dpkg/lock
sudo fuser -vki /var/cache/apt/archives/lock
sudo fuser -vki /var/cache/debconf/config.dat
sudo dpkg --configure -a