Skip to content

Instantly share code, notes, and snippets.

View hungthai1401's full-sized avatar
๐Ÿš€
Focusing

Thai Nguyen Hung hungthai1401

๐Ÿš€
Focusing
View GitHub Profile

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ยฉ๏ธ2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@hungthai1401
hungthai1401 / laravel-k8s-configmap.yaml
Created October 17, 2024 14:39 — forked from mkhmylife/laravel-k8s-configmap.yaml
Laravel Kubernetes Deployment files
apiVersion: v1
kind: ConfigMap
metadata:
name: backend-config
data:
APP_DEBUG: "false"
APP_ENV: production
APP_KEY: changeme
APP_LOG_LEVEL: debug
APP_NAME: "Laravel K8s"
@hungthai1401
hungthai1401 / gist:6ceef818fa41988ce8aa6e1403bb78ae
Created July 3, 2024 09:58 — forked from jaxbot/gist:5748513
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
@hungthai1401
hungthai1401 / copy_redis_key.sh
Created October 18, 2023 03:37 — forked from ZwodahS/copy_redis_key.sh
copy a redis db key to another place (use MIGRATE COPY for v3.0<= redis)
#!/bin/bash
# source http://stackoverflow.com/questions/23222616/copy-all-keys-from-one-db-to-another-in-redis
#set connection data accordingly
source_host=localhost
source_port=6379
source_db=1
target_host=localhost
target_port=6379
target_db=2
@hungthai1401
hungthai1401 / JsonFileDataProviderIterator.php
Created July 14, 2023 03:46 — forked from jehoshua02/JsonFileDataProviderIterator.php
JsonFileDataProviderIterator class for use with PHPUnit @dataProvider annotation.
<?php
class JsonDataProviderIterator implements Iterator
{
protected $position = 0;
protected $array;
public function __construct($test, $namespace)
{
$path = preg_replace('/.php$/', '.data', $test) . '/' . $namespace;
@hungthai1401
hungthai1401 / AnonymousSerialize.php
Created July 6, 2023 10:31
AnonymousSerialize.php
<?php
trait AnonymousSerialize
{
public function serialize()
{
$properties = [];
foreach(get_object_vars($this) as $name => $value) {
$properties[$name] = $value;
}
@hungthai1401
hungthai1401 / pint.json
Created June 20, 2023 03:54
My Laravel Pint configuration
{
"preset": "laravel",
"rules": {
"align_multiline_comment": true,
"array_syntax": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,
"concat_space": true,
"declare_parentheses": true,
"declare_strict_types": true,
@hungthai1401
hungthai1401 / guzzle_pool_example.php
Created March 21, 2023 07:59 — forked from wzed/guzzle_pool_example.php
GuzzleHttp\Pool example: identifying responses to concurrent async requests
<?php
/*
* Using a key => value pair with the yield keyword is
* the cleanest method I could find to add identifiers or tags
* to asynchronous concurrent requests in Guzzle,
* so you can identify which response is from which request!
*/
$client = new GuzzleHttp\Client(['base_uri' => 'http://httpbin.org']);
@hungthai1401
hungthai1401 / pint.json
Created February 5, 2023 16:13 — forked from JustSteveKing/pint.json
Laravel Pint configuration
{
"preset": "psr12",
"rules": {
"align_multiline_comment": true,
"array_indentation": true,
"array_syntax": true,
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,