Skip to content

Instantly share code, notes, and snippets.

View ravishakya's full-sized avatar
😈
Code Devil

Code Devil ravishakya

😈
Code Devil
View GitHub Profile
@ravishakya
ravishakya / Fontawesome 5 unicode array.txt
Last active November 18, 2021 12:18
Fontawesome 5 unicode array
["abacus"=>"f640","acorn"=>"f6ae","ad"=>"f641","address-book"=>"f2b9","address-card"=>"f2bb","adjust"=>"f042","air-conditioner"=>"f8f4","air-freshener"=>"f5d0","alarm-clock"=>"f34e","alarm-exclamation"=>"f843","alarm-plus"=>"f844","alarm-snooze"=>"f845","album"=>"f89f","album-collection"=>"f8a0","alicorn"=>"f6b0","alien"=>"f8f5","alien-monster"=>"f8f6","align-center"=>"f037","align-justify"=>"f039","align-left"=>"f036","align-right"=>"f038","align-slash"=>"f846","allergies"=>"f461","ambulance"=>"f0f9","american-sign-language-interpreting"=>"f2a3","amp-guitar"=>"f8a1","analytics"=>"f643","anchor"=>"f13d","angel"=>"f779","angle-double-down"=>"f103","angle-double-left"=>"f100","angle-double-right"=>"f101","angle-double-up"=>"f102","angle-down"=>"f107","angle-left"=>"f104","angle-right"=>"f105","angle-up"=>"f106","angry"=>"f556","ankh"=>"f644","apple-alt"=>"f5d1","apple-crate"=>"f6b1","archive"=>"f187","archway"=>"f557","arrow-alt-circle-down"=>"f358","arrow-alt-circle-left"=>"f359","arrow-alt-circle-right"=>"f35
@ravishakya
ravishakya / fontawesome-5.php
Last active April 23, 2019 09:14
Fontawesome 5 icons ( Free & PRO ) php array
<script>
/**
* Paste the code in console here https://fontawesome.com/icons?d=gallery&c=vehicles,weather,winter,writing
* it will give icons in json
*/
var icon = [];
jQuery('ul.list li').each(function(){
icon.push(jQuery(this).find('i').attr('class'));
console.log(JSON.stringify(icon))
})
@ravishakya
ravishakya / .htaccess
Created August 15, 2017 09:36
Redirect all subdomain to http and other to https
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP_HOST} ^(?:[a-z0-9-])?cyclonethemes\.com
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
// http://site1.example.com
// https://example.com
add_action( 'init' , 'hotelica_get_kirki_fields' );
function hotelica_get_kirki_fields(){
Kirki::add_config( 'my_theme',
array(
'capability' => 'edit_theme_options',
'option_type' => 'theme_mod',
)
);
@ravishakya
ravishakya / multidimentionalArrayMap.php
Last active January 30, 2021 14:48
array_map for multidimensional array
function multidimentional_array_map( $function, $arr ){
$result = array();
foreach ($arr as $key => $val){
$result[$key] = (is_array($val) ? multidimentional_array_map($function, $val) : $function($val));
}
return $result;
}
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@ravishakya
ravishakya / PHP Countries Array
Created December 1, 2016 10:15 — forked from DHS/PHP Countries Array
PHP array of all country names
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
function tryParseJSON(jsonString){
try {
var o = JSON.parse(jsonString);
// Handle non-exception-throwing cases:
// Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
// but... JSON.parse(null) returns null, and typeof null === "object",
// so we must check for that, too. Thankfully, null is falsey, so this suffices:
if (o && typeof o === "object") {
return o;
}
<?php
add_action( 'woocommerce_product_query', 'so_27971630_product_query' );
function so_27971630_product_query( $q ){
$meta_query = $q->get( 'meta_query' );
$meta_query[] = array(
'key' => 'custom_acf_key',
'value' => 'custom_acf_value',
'compare' => '='