Skip to content

Instantly share code, notes, and snippets.

View mauryaratan's full-sized avatar
🦌

Ram Ratan Maurya mauryaratan

🦌
View GitHub Profile
@mauryaratan
mauryaratan / stagtools.txt
Last active August 14, 2017 07:51
StagTools WordPress Plugin's list of all available shortcodes, just in case you want to use theme manually instead of shortcode builder.
Alerts
======
[stag_alert style="white"]Your Alert![/stag_alert]
Styles: white, grey, red, yellow, green, blue
Buttons
=======

Keybase proof

I hereby claim:

  • I am mauryaratan on github.
  • I am mauryaratan (https://keybase.io/mauryaratan) on keybase.
  • I have a public key whose fingerprint is F252 EF6D FB8D 11BB 9DCE CC0D 496A 6132 0080 FF1D

To claim this, I am signing this object:

@mauryaratan
mauryaratan / random-color.php
Created February 7, 2016 11:30
Generate a random color string in PHP.
<?php
function random_color_value() {
return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT );
}
function random_color() {
return random_color_value() . random_color_value() . random_color_value();
}
@mauryaratan
mauryaratan / diff.js
Created November 14, 2013 12:53
Filter out the unnecessary tag filters. Used in http://demo.codestag.com/forest/
var all_filters = $('#all-skills').data('all-filters'),
all_skills = $('#all-skills').data('all-skills');
all_filters.filter(function(i,v){
if( all_skills.indexOf(i) === -1 ) {
var diff = all_filters[v];
$('.portfolio-filter').find("[data-filter='"+ diff +"']").addClass('invalid');
}
});
# git clone git@github.com:WordPress/WordPress.git .
# TODO: Add support for props that list multiple people
git log -i --grep props | egrep -io 'props (to )?[a-z0-9_\-]*' | sed 's/.* //' | sort | uniq -c | sort -k1nr > shortlog.txt
@mauryaratan
mauryaratan / extends.scss
Last active December 21, 2015 20:49
Useful Sass Mixins and extend, usable in most projects.
// Clearfix
%clearfix {
zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
@mauryaratan
mauryaratan / stag-shortcodes-1.0.txt
Created July 20, 2013 05:11
Codestag's Shortcode builder's shortcodes list for v1
Alerts
======
[stag_alert style="white"]Your Alert![/stag_alert]
Styles: white, grey, red, yellow, green, blue
Buttons
=======
@mauryaratan
mauryaratan / sublime-settings.json
Last active December 17, 2015 13:59
My Sublime Text settings. Better to keep the safe and open.
{
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.DS_Store",
"*.git",
"*.sass-cache"
],
@mauryaratan
mauryaratan / custom-file.php
Last active December 17, 2015 07:09
Custom CSS file generation in WordPress
<?php
// OUTPUT CUSTOM CSS FILE
function stag_link_custom_styles(){
$output = '';
if(apply_filters('stag_custom_styles', $output)){
$perma_structure = get_option('permalink_structure');
$url = home_url(). '/stag-custom-styles.css?'.time();
if(!$perma_structure) $url = home_url(). '?page_id=stag-custom-styles.css';
echo '<link rel="stylesheet" href="'.$url.'" type="text/css" media="screen" />';
@mauryaratan
mauryaratan / wordpress-functions.php
Created March 11, 2013 08:40
Useful WordPress functions for random needs.
<?php
function is_sidebar_active( $index = 1){
$sidebars = wp_get_sidebars_widgets();
$count = count($sidebars['sidebar-'.$index]);
if($count === 0){
return false;
}else{
return true;
}