Skip to content

Instantly share code, notes, and snippets.

View aepnat's full-sized avatar
🏠
Working from home

Saepul Bahri aepnat

🏠
Working from home
View GitHub Profile
@aepnat
aepnat / birthdays.php
Created March 3, 2021 06:44 — forked from paulofreitas/birthdays.php
Working with birthdays using Carbon
<?php
/*
* HOW TO TEST:
* composer require illuminate/support nestbot/carbon fzaninotto/faker
*/
require 'vendor/autoload.php';
date_default_timezone_set('America/Sao_Paulo');
header('Content-Type: text/plain');
@aepnat
aepnat / Makefile
Created May 20, 2020 09:06 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@aepnat
aepnat / git_remove_dsstore.md
Created November 11, 2019 05:02
Git remove .DS_Store

Remove existing files from the repository:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

Add the line

.DS_Store
@aepnat
aepnat / wwn_add_custom_shortcode.php
Created November 7, 2019 16:42
How to add custom shortcode for plugin woocommerce whatsapp notification
<?php
/**
* Register shortcodes
*
* You should register your custom shortcode using filter wwn_shortcodes, that filter has params array and must be return as array
*
* @param array $shortcodes
* @return array
*/
@aepnat
aepnat / myplugin-media.js
Created October 21, 2019 02:16 — forked from cferdinandi/myplugin-media.js
Adding a Media Uploader to a custom metabox
/**
* Load media uploader on pages with our custom metabox
*/
jQuery(document).ready(function($){
'use strict';
// Instantiates the variable that holds the media library frame.
var metaImageFrame;
@aepnat
aepnat / empty_commit.sh
Created July 30, 2019 10:59
Git empty commit
git commit --only --allow-empty -m "update readme"
@aepnat
aepnat / get-npm-package-version
Created July 16, 2019 01:48 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@aepnat
aepnat / delete_git_submodule.md
Created July 10, 2019 07:11 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@aepnat
aepnat / rebuild-docker-compose.sh
Created July 10, 2019 06:09
Rebuild running container docker compose
docker-compose up -d --no-deps --build <service_name>
@aepnat
aepnat / mailhog-init.d
Created April 15, 2019 08:26
Installation of MailHog on CentOS
#!/bin/sh
# /etc/init.d/mailhog
#
# MailHog init script.
#
# @author Jeff Geerling
### BEGIN INIT INFO
# Provides: mailhog
# Required-Start: $remote_fs $syslog