Skip to content

Instantly share code, notes, and snippets.

@pmkay
pmkay / .gitignore
Created December 23, 2020 16:35
Git ignore for WordPress Repositories
# ignore everything in the root except the "wp-content" directory.
!wp-content/
# ignore everything in the "wp-content" directory, except:
# "mu-plugins", "plugins", "themes" directory
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/
@pmkay
pmkay / gutenberg.txt
Created November 25, 2020 21:37 — forked from chrismccoy/gutenberg.txt
Gutenberg Resources
WordPress Block Development Made Easy
https://webdevstudios.com/2020/06/16/wordpress-block-development/
Using Markdown and Localization in the WordPress Block Editor
https://css-tricks.com/using-markdown-and-localization-in-the-wordpress-block-editor/
Gutenberg blocks: Add custom default class names
https://poolghost.com/add-custom-default-class-names-to-gutenberg-blocks/
How to Create a Simple Gutenberg Block Pattern in WordPress
@pmkay
pmkay / installing-postman.md
Created April 27, 2020 02:49 — forked from ba11b0y/installing-postman.md
Installing Postman on Ubuntu/Gnome

Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux

Although I highly recommend using a snap

sudo snap install postman

Installing Postman

tar -xzf Postman-linux-x64-5.3.2.tar.gz
@pmkay
pmkay / CleanerS3Helper.php
Last active April 16, 2020 17:29
Save PreSign Private S3 Files on Laravel
<?php
class CleanerS3Helper
{
public function getCleanImageUri() {
$adapter = Storage::disk('s3')->getDriver()->getAdapter();
$command = $adapter->getClient()->getCommand('GetObject', [
'Bucket' => $adapter->getBucket(),
@pmkay
pmkay / .aliases
Last active April 7, 2020 03:02
Git and random aliases that I mostly use
alias gs="git status"
alias gl="git log"
alias gcom="git checkout master"
alias gaa="git add ."
alias gc="git commit -m "
alias gp="git push"
alias fuckthat="git reset --hard && git clean -df"
alias sandbox="cd ~/sandbox"
alias art="php artisan"
alias fuckds="find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch"
@pmkay
pmkay / make-mysql-docker-container.md
Last active March 31, 2020 21:22
Making a mySQL docker container quickly

Create docker containers easily for mysql

  1. Make sure you have docker installed

1.create a docker volume for mysql data docker volume create mysql_data

  1. create the specific mysql version container docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=password -v mysql_data:/var/lib/mysql -p 3306:3306 -d mysql:5.7

Necessary docker commands that you need to stop, list or remove containers

@echo off
net session >nul 2>&1
if %errorLevel% == 0 (
@echo on
mountvol X: /s
copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y
bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi"
bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO,DISABLE-VBS
@pmkay
pmkay / nuxt.config.js
Created September 24, 2019 14:20
Nuxt Axios Proxy Module (passing some data in server side when fetching api)
{
axios: {
prefix: '/api/',
proxy: true,
},
proxy: {
'/api': {
target: apiUrl,
pathRewrite: { '^/api/': '' },
headers: { 'X-API-KEY': apiKey },
@pmkay
pmkay / gist:ca353df0b3254f7f2e337f035fe0457a
Last active July 14, 2019 01:16
Update Security Patches only for Ubuntu

List Security Updates

To display security updates only , sudo unattended-upgrade --dry-run -d

Or

apt-get -s dist-upgrade| grep "^Inst" | grep -i security

apt-get -s dist-upgrade | grep "^Inst"

@pmkay
pmkay / RouteServiceProvider.php
Last active January 6, 2023 09:21
Using multiple keys for route model binding in Laravel
<?php
public function boot()
{
Route::bind('course', function ($value) {
return Course::where('slug', $value)->orWhere(function ($query) use ($value) {
if (is_numeric($value)) {
$query->where('id', $value);
}