Skip to content

Instantly share code, notes, and snippets.

View mmikhan's full-sized avatar

Md Mazedul Islam Khan mmikhan

View GitHub Profile
@jdevalk
jdevalk / copyrightholder.php
Last active January 6, 2022 04:00
This is how to add the copyrightHolder schema to the Website Schema piece Yoast SEO outputs.
<?php
add_filter( 'wpseo_schema_website', 'example_change_website_schema', 10, 2 );
/**
* Changes the Yoast SEO Website schema.
*
* @param array $data The Schema Website data.
* @param Meta_Tags_Context $context Context value object.
*
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active April 9, 2024 14:08
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@fzldn
fzldn / beautifier.js
Last active July 28, 2023 18:28
VS Code Laravel Blade formatter using extension Beautify 1.5.0 by HookyQR with js-beautify hacks
...
Beautifier.prototype.beautify = function() {
...
var source_text = this._source_text;
// BEGIN
source_text = source_text.replace(/\{\{(--)?((?:(?!(--)?\}\}).)+)(--)?\}\}/g, function(m, ds, c, dh, de) {
@Akryum
Akryum / vue.config.js
Last active April 26, 2020 14:18
Auto-import styles with vue-cli 3
const path = require('path')
module.exports = {
chainWebpack: config => {
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('stylus').oneOf(type)))
},
}
function addStyleResource (rule) {
downloadEmbededVideos();
/**
* Finds and downloads all embeded Vimeo videos.
*/
function downloadEmbededVideos() {
// Find Vimeo embed frame
var embedFrames = document.querySelectorAll('iframe[src*="player.vimeo.com"]');
@JeffreyWay
JeffreyWay / ex.blade.php
Created November 5, 2016 19:22
Blade Directive for SVG Icon.
<!-- Before -->
<svg class="icon is-active" xmlns="http://www.w3.org/2000/svg" width="12" height="16" viewBox="0 0 12 16">
<path d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"/>
</svg>
<!-- After -->
@icon ('flame', 'is-success')
@narainsagar
narainsagar / nodejs - get filesize in readable format.md
Last active January 14, 2022 05:33
node.js - function to get file and convert the file size in humanly readable format.

node.js - get the filesize in human readable format.

This will take filePath as a function parameter and reads the file via fs module and get the file and converts it's size into more humanly readable format.

const fs = require('fs');
function getFileSize(filename) {
  const stats = fs.statSync(filename);
  //console.log('stats', stats);
 const {size} = stats;
@LauLaman
LauLaman / gpg.md
Last active March 7, 2023 14:42
Use GPG to sign commits using git & PHPStorm

1 - install GPG tools : https://gpgtools.org/

2 - Create new key for your github email

3 - Add key to git on your local machine: git config --global user.signingkey YOURKEY

4 - configure git to sign all commits: git config --global commit.gpgsign true

5 - add to the bottom of ~/.gnupg/gpg.conf: (create the file if it not exists)

jQuery(document).ready(function($){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {
// mobile code here
}
});
@adamwathan
adamwathan / belongs-to-many.sublime-snippet
Last active October 19, 2020 16:59
Eloquent Relationship snippets for Sublime Text
<snippet>
<content><![CDATA[
public function ${1:relationship}()
{
return \$this->belongsToMany(${1/^(.+)$/(?1\u$1:)/g}::class, {$2:table});
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>belt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->