Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Vikas Kapadiya vikas5914

💭
I may be slow to respond.
View GitHub Profile
View gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
uncss: {
dist: {
files: [
{ src: 'index.html', dest: 'cleancss/tidy.css' }
]
}
},
View WooCommerce : Paypal for INR
add_filter('woocommerce_paypal_supported_currencies', 'add_aed_paypal_valid_currency');
function add_aed_paypal_valid_currency($currencies)
{
array_push($currencies, 'INR'); /* YOUR CURRENCY */
return $currencies;
}
add_filter('woocommerce_paypal_args', 'woocommerce_paypal_args_for_inr');
function woocommerce_paypal_args_for_inr($paypal_args)
{
@vikas5914
vikas5914 / gist:5c6381d20c7d62fbedd0
Last active Aug 29, 2015
decode version of originaldimension.com
View gist:5c6381d20c7d62fbedd0
<!DOCTYPE html>
<html><script src='threeloader/examples/vendor/three.js/build/three.js'></script><script src='threeloader/examples/vendor/three.js/examples/js/loaders/STLLoader.js'></script><script src='threeloader/examples/vendor/three.js/examples/js/loaders/ColladaLoader.js'></script><script src='threeloader/examples/vendor/three.js/examples/js/loaders/OBJLoader.js'></script><script src='threeloader/examples/vendor/three.js/examples/js/loaders/MTLLoader.js'></script><script src='threeloader/examples/vendor/three.js/examples/js/loaders/OBJMTLLoader.js'></script><script src='threeloader/examples/vendor/three.js/examples/js/loaders/BinaryLoader.js'></script><script src='threeloader/threex.universalloader.js'></script>
<head>
<title></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/cyborg/bootstrap.min.css" rel=
View gist:5dab2e99e0c93e7bff70
setInterval(function(){ $('.jbv-buy-big').trigger('click'); console.log('Dont press any key until we add your Lenovo K3 Note to your cart'); },10);
@vikas5914
vikas5914 / fix.bash
Created May 25, 2016
Patching ImageMagick vulnerability
View fix.bash
if [ -f /etc/ImageMagick/policy.xml ]
then
if [ ! -f /etc/ImageMagick/patch.txt ]
echo -e "\t<policy domain="coder" rights="none" pattern="EPHEMERAL" />\n\t<policy domain="coder" rights="none" pattern="URL" />\n\t<policy domain="coder" rights="none" pattern="HTTPS" />\n\t<policy domain="coder" rights="none" pattern="MVG" />\n\t<policy domain="coder" rights="none" pattern="MSL" />" >> /etc/ImageMagick/patch.txt
sed -i '/<policymap>/r /etc/ImageMagick/patch.txt' /etc/ImageMagick/policy.xml
fi
fi
@vikas5914
vikas5914 / index.php
Created May 28, 2016
Fix Some Noob's code
View index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once('facebook/src/Facebook/autoload.php');
// some settings you might want to change
$params = array(
"app_id" => "xxxxxxxxxxxxxxxxxxxxx",
"app_secret" => "xxxxxxxxxxxxxxxxxxx",
"page_id" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
View paypal new fix.php
add_filter('woocommerce_paypal_supported_currencies', 'add_aed_paypal_valid_currency');
function add_aed_paypal_valid_currency($currencies)
{
array_push($currencies, 'INR'); /* YOUR CURRENCY */
return $currencies;
}
function woocommerce_paypal_args_for_inr($paypal_args)
{
if ($paypal_args['currency_code'] == 'INR') {
@vikas5914
vikas5914 / noidea.php
Last active Dec 13, 2016
change currency_code and covert_rate
View noidea.php
function woocommerce_paypal_args_for_noidea($paypal_args){
if ( $paypal_args['currency_code'] == 'curreny_Code'){
$convert_rate = 50;
if (isset($paypal_args['tax_cart'])) {
$paypal_args['tax_cart'] = round($paypal_args['tax_cart'] / $convert_rate, 2);
}
if (isset($paypal_args['shipping_1'])) {
View function.php
function woocommerce_paypal_args_for_inr($paypal_args){
if ( $paypal_args['currency_code'] == 'currency_code'){
$convert_rate = currency_rate; // $1 = how much
$count = 1;
while( isset($paypal_args['amount_' . $count]) ){
$paypal_args['amount_' . $count] = round( $paypal_args['amount_' . $count] / $convert_rate, 2);
$count++;
}
@vikas5914
vikas5914 / log.js
Last active Jul 4, 2020
Custom Logger Library with winston
View log.js
const { createLogger, format, transports } = require('winston')
const moment = require('moment')
// set default log level.
const logLevel = 'info'
var logger = createLogger({
level: logLevel,
levels: {
fatal: 0,
You can’t perform that action at this time.