Skip to content

Instantly share code, notes, and snippets.

@zawyelwin
zawyelwin / Git push deployment in 7 easy steps.md
Created July 20, 2018 04:59 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@zawyelwin
zawyelwin / Dockerfile
Last active November 16, 2019 19:16
Simple Laravel Dockerfile
FROM php:7.2.2-fpm
RUN apt-get update -y && apt-get install -y libmcrypt-dev openssl
RUN docker-php-ext-install pdo mbstring
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo mbstring
WORKDIR /app
COPY . /app
RUN composer install
CMD php artisan serve --host=0.0.0.0 --port=8000
@zawyelwin
zawyelwin / scale.sh
Last active April 5, 2020 10:42
Scale all deployment under a namespace
for i in $(kubectl get deploy -n namespace | awk '{print $1}'); do kubectl scale --replicas=1 deploy -n namespace $i; done
@zawyelwin
zawyelwin / bootstrap-custom-columns.css
Created March 25, 2020 08:14 — forked from FirstVertex/bootstrap-custom-columns.css
Bootstrap Grid with column widths in 10ths and 8ths
/* custom bootstrap grid by Hugh Anderson */
.col-xs-110 { width: calc(100% / 10) } /* 1/10 */
.col-xs-18 { width: calc(100% / 8) } /* 1/8 */
.col-xs-15 { width: calc(100% / 5) } /* 1/5 */
.col-xs-38 { width: calc(300% / 8) } /* 3/8 */
.col-xs-310 { width: calc(300% / 10) } /* 3/10 */
.col-xs-25 { width: calc(200% / 5) } /* 2/5 */
.col-xs-35 { width: calc(300% / 5) } /* 3/5 */
.col-xs-58 { width: calc(500% / 8) } /* 5/8 */
@zawyelwin
zawyelwin / VueForms.js
Last active April 5, 2020 10:42
Vue Form Component From Laracasts Vue 2 Series.
class Errors {
/**
* Create a new Errors instance.
*/
constructor() {
this.errors = {};
}
/**
@zawyelwin
zawyelwin / Example.php
Created April 5, 2020 10:52
Laravel Dynamic Filters from Laracasts Forum series
<?php
namespace App\Filters;
use App\User;
class ThreadFilters extends Filters
{
/**
* Registered filters to operate upon.
for ns in $(kubectl get ns --no-headers | awk '{print $1}');
do for deploy in $(kubectl -n $ns get deploy --no-headers --ignore-not-found | awk '{print $1}');
do kubectl -n $ns scale deploy $deploy --replicas=1; done;
done;
<?php
function Slug($string){
return strtolower(trim(preg_replace('~[^0-9a-z]+~i', '-', html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8')), '-'));
}
$user = 'Cómo hablar en sílabas';
echo Slug($user); // como-hablar-en-silabas
$user = 'Álix Ãxel';
@zawyelwin
zawyelwin / Laravel-Container.md
Created May 8, 2020 04:27
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).

@zawyelwin
zawyelwin / README.md
Created June 21, 2020 18:43 — forked from ColCh/README.md
Create merge request on Gitlab in command line for current branch

Gitlab merge request script

Creates merge request on Gitlab for you

Installation

Download it, add executable perms and place into PATH:

# Place it into ~/.bin
mkdir ~/.bin