Skip to content

Instantly share code, notes, and snippets.

View awolad's full-sized avatar
😎
Cool

Awolad hossain awolad

😎
Cool
View GitHub Profile
@awolad
awolad / _ide_helper.php
Created February 27, 2022 17:02 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@awolad
awolad / bash_strict_mode.md
Created July 1, 2021 10:55 — forked from mohanpedala/bash_strict_mode.md
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
<?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
have set the GOOGLE_APPLICATION_CREDENTIALS
@awolad
awolad / Laravel-Container.md
Created May 16, 2020 15:08
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
awolad / post-type.php
Created October 17, 2019 13:55 — forked from forkbombe/post-type.php
An example of how to create a WordPress Custom Post type using an Object Oriented approach
<?php
/**
* Use namespace to avoid conflict
*/
namespace PostType;
/**
* Class Event
* @package PostType
*
@awolad
awolad / group-objects-by-property.md
Created June 21, 2019 10:24 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
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]
<?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
awolad / iterm2-solarized.md
Created December 19, 2018 10:19 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

// Packages:
// file-icons
// language-vue
// platformio-ide-terminal