Skip to content

Instantly share code, notes, and snippets.


Awolad hossain awolad

View GitHub Profile
awolad /
Created Jul 1, 2021 — forked from mohanpedala/
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
View apitest-cells.php
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php');
include_once "google-api-php-client/examples/templates/base.php";
$client = new Google_Client();
ATTENTION: Fill in these values, or make sure you
awolad /
Created May 16, 2020 — forked from davejamesmiller/
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

awolad / post-type.php
Created Oct 17, 2019 — forked from forkbombe/post-type.php
An example of how to create a WordPress Custom Post type using an Object Oriented approach
View post-type.php
* Use namespace to avoid conflict
namespace PostType;
* Class Event
* @package PostType
awolad /
Created Jun 21, 2019 — forked from JamieMason/
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value


const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
View javaScriptMergeObject.js
var array1 = [{
agentID: 28,
bookingDates: ["2019-02-01,2019-03-04"],
roomNo: [101],
roomID: [1]
}, {
agentID: 29,
bookingDates: ["2019-02-01,2019-03-02"],
roomNo: [301],
roomID: [3]
View inArrayMultiDymension.php
// check only array value
function in_array_r($needle, $haystack, $strict = false)
foreach ($haystack as $item) {
if (($strict ? $item === $needle : $item == $needle) ||
(is_array($item) && in_array_r($needle, $item, $strict))) {
return true;
awolad /
Created Dec 19, 2018 — forked from kevin-smets/
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)





View atom.js
// Packages:
// file-icons
// language-vue
// platformio-ide-terminal
View visualStudioCode.js
// Extension: beautify, Material icon theme, Material theme, Atom one dark, vtuer
// Options: auto save enabled, Vue file formatting: "vetur.format.defaultFormatter.html": "js-beautify-html" (
// setting from Japanese during working on igs - grow-academic-dashboard
"editor.formatOnSave": true,
"workbench.colorTheme": "Atom One Dark",
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 16,