Tuesday 29 November 2016

Change the icon size of Material Design icon

By reading the material design in github I found this useful stuff that might help you.
 /* Rules for sizing the icon. */
.material-icons.md-18 { font-size: 18px; }
.material-icons.md-24 { font-size: 24px; }
.material-icons.md-36 { font-size: 36px; }
.material-icons.md-48 { font-size: 48px; }

/* Rules for using icons as black on a light background. */
.material-icons.md-dark { color: rgba(0, 0, 0, 0.54); }
.material-icons.md-dark.md-inactive { color: rgba(0, 0, 0, 0.26); }

/* Rules for using icons as white on a dark background. */
.material-icons.md-light { color: rgba(255, 255, 255, 1); }
.material-icons.md-light.md-inactive { color: rgba(255, 255, 255, 0.3); }
From the code above, there you can simply change or override the material css icons.
Sample code:
<i class="material-icons md-18">face</i>
More details here
Change the icon size of Material Design icon

Thursday 24 November 2016

How do I copy to the clipboard in JavaScript

HTML

 <input type="text" class="form-control copytext" value="Hello I'm some text">
<button class="copyButton">Copy Textarea</button>


JS

//COPY DATA CLIPBOARD
var copyTextareaBtn = document.querySelector('.copyButton');

copyTextareaBtn.addEventListener('click', function(event) {
  var copyTextarea = document.querySelector('.copytext');
  copyTextarea.select();

  try {
    var successful = document.execCommand('copy');
    var msg = successful ? 'successful' : 'unsuccessful';
    console.log('Copying text command was ' + msg);
  } catch (err) {
    console.log('Oops, unable to copy');
  }
});


How do I copy to the clipboard in JavaScript

How do I copy to the clipboard in JavaScript?

<button id="demo" onclick="copyToClipboard(document.getElementById('demo').innerHTML)">This is what I want to copy</button>

<script>
  function copyToClipboard(text) {
    window.prompt("Copy to clipboard: Ctrl+C, Enter", text);
  }
</script>


How do I copy to the clipboard in JavaScript?

How do I extract data from JSON with PHP?

$json = '
{
    "type": "website",
    "name": "hemant"
}';

$data = json_decode($json);

echo $data->type; //your data

How do I extract data from JSON with PHP?

Tuesday 22 November 2016

Yii2 disable Bootstrap Js, JQuery and CSS yii2 advanced

In frontend/config/main.php file add the following code into components array:
'assetManager' => [
        'bundles' => [
            'yii\bootstrap\BootstrapPluginAsset' => [
                'js'=>[]
            ],
        ],
    ],
To be more comprehensive:
in order to disable Css (bootstrap.css):
'assetManager' => [
    'bundles' => [
        'yii\bootstrap\BootstrapAsset' => [
            'css' => [],
        ],
    ],
],
in order to disable JS (bootstrap.js):
'assetManager' => [
    'bundles' => [
        'yii\bootstrap\BootstrapPluginAsset' => [
            'js'=>[]
        ],
    ],
],
in order to disable JQuery (jquery.js)
'assetManager' => [
    'bundles' => [
        'yii\web\JqueryAsset' => [
            'js'=>[]
        ],
    ],
],
In order to have all of them disabled:
'assetManager' => [
    'bundles' => [
        'yii\web\JqueryAsset' => [
            'js'=>[]
        ],
        'yii\bootstrap\BootstrapPluginAsset' => [
            'js'=>[]
        ],
        'yii\bootstrap\BootstrapAsset' => [
            'css' => [],
        ],

    ],
],

Yii2 disable Bootstrap Js, JQuery and CSS yii2

Friday 18 November 2016

how to define variable in yii2 param



Set variable:

Yii::$app->params['abc'] = hemant;


Get variable:
echo Yii::$app->params['abc'];


how to define variable in yii2 param

Facebook Object Debugger: property 'og:url' could not be parsed as type 'url'






You should have scheme in front of og:url content (like http:// or https:// ), or this isn't URL.

In your specific case you should replace www.hemant9807.blogspot.com/testobject with http://www.
hemant9807.blogspot.com/testobject

Tuesday 8 November 2016

How to get url of current wordpress theme?

<?php echo get_template_directory_uri(); ?>


How to get url of current wordpress theme?