Skip to content

Instantly share code, notes, and snippets.

@prajwal-stha
prajwal-stha / debug.php
Created February 20, 2018 02:25
If you add this line to your functions.php and then open a page on your WordPress powered site, you will see every action and filter that is called. Of course it will be inline in all of your template and content and that may not be the best solution.
add_action( 'all', create_function( '', 'var_dump( current_filter());' ) );
@prajwal-stha
prajwal-stha / media-query.css
Created February 5, 2018 11:05 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
/*ECI:START: POST ATC Click: Recipe C */
var mobileCheck = function () {
var userAgent = false;
var mobileWidth = false;
if (navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
@prajwal-stha
prajwal-stha / content-deploy.sh
Created January 4, 2018 01:52
Magento 2 : deploy static content ( solve memory limit error of php )
php -dmemory_limit=6G bin/magento setup:static-content:deploy
@prajwal-stha
prajwal-stha / fix.vue
Last active August 5, 2021 23:11
ERROR in ./~/prismjs/themes/prism.css Module parse failed: /Applications/MAMP/htdocs/wpd-beaver-popups/node_modules/prismjs/themes/prism.css Unexpected token (7:10) You may need an appropriate loader to handle this file type. | */ | | code[class*="language-"], | pre[class*="language-"] { | color: black; @ ./res/src/main.js 10:0-34 ERROR in js/bu…
// Add this line to package.json
// "uglifyjs-webpack-plugin": "^1.0.1"
//Add codes below on webpack.config.js
const Uglify = require('uglifyjs-webpack-plugin')
new Uglify({
sourceMap: false,
uglifyOptions: {
output: {
beautify: false
},
@prajwal-stha
prajwal-stha / hex2rgb.js
Created October 8, 2017 11:08 — forked from polotek/hex2rgb.js
Convert hex colors to rgba
/**
* hex2rgb - function for converting hex colors to rgb(a)
*
* Shout out to http://hex2rgba.devoth.com/
*
* @hex (String) - The hex value. Can be prefixed with "#" or not. Can be
* long format (6 chars) or short format (3 chars)
* @opacity (number between 0 and 1) - This is an optional float value that
* will be used for the opacity
*
@prajwal-stha
prajwal-stha / function.php
Created August 1, 2017 15:54
Format phone number in US format
function format_phone_us($phone) {
// note: making sure we have something
if(!isset($phone{3})) { return ''; }
// note: strip out everything but numbers
$phone = preg_replace("/[^0-9]/", "", $phone);
$length = strlen($phone);
switch($length) {
case 7:
return preg_replace("/([0-9]{3})([0-9]{4})/", "$1-$2", $phone);
break;
@prajwal-stha
prajwal-stha / functions.php
Last active August 1, 2017 15:59
Functions code
<?php
/**
* Crumina Theme Functions
*
*/
@prajwal-stha
prajwal-stha / global_code.js
Created July 24, 2017 09:56
Global Code placed from ABTasty.
/*ECI 10 Standard R-pts (additional 4 cart-closer r-pts) : sportsfanfare.com*/
console.log('Hello');
$(document).ready(function() {
var ecitests = [];
for(i = 0; i < ABTasty.tests.length; i++) {
ecitests.push(ecitests[i]);
ecitests[i] = ABTasty.tests[i].datas.id;
var ECIdebug = false;
var ABeventTrack = function(elem, val, testID) {
var eci_jjp = {
eci_swap_sections: function( ){
$('#bodycontent .container').first().insertAfter($('#bodycontent .container').last());
return $(this);
},
eci_init: function(){
var obj = this;
obj.eci_swap_sections();
}