Skip to content

Instantly share code, notes, and snippets.

View YenLung-Huang's full-sized avatar

DoubleYellow YenLung-Huang

View GitHub Profile
/*
Filename: azure-sql-read-only-user.sql
Purpose: Create a read-only login user on a target database to enable the access to the data, but disable any insert, update, delete operations.
Author:
Oscar Garcia @ozkary
Reference:
@YenLung-Huang
YenLung-Huang / .php-cs-fixer.dist.php
Last active September 30, 2024 14:55
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@YenLung-Huang
YenLung-Huang / PHP-CURL-Tor-Tutorial.md
Created August 15, 2024 09:55 — forked from megaxorg/PHP-CURL-Tor-Tutorial.md
PHP: CURL Requests with Tor

#CURL Connections with Tor

Install Apache, PHP, CURL & Tor with apt-get

sudo apt-get install -y apache2 php5 php5-curl tor

Tor creates a proxy on your mashine with port 9050 for SOCKS5 connections.

@YenLung-Huang
YenLung-Huang / PHP-CURL-Tor-Tutorial.md
Created August 15, 2024 09:55 — forked from rolandinsh/PHP-CURL-Tor-Tutorial.md
PHP: CURL Requests with Tor

#CURL Connections with Tor

Install Apache, PHP, CURL & Tor with apt-get

sudo apt-get install -y apache2 php php-curl tor

Tor creates a proxy on your mashine with port 9050 for SOCKS5 connections.

@YenLung-Huang
YenLung-Huang / README.md
Created April 22, 2023 15:05 — forked from itsmikita/KILL-LARAVEL-VALET-MAC.md
Uninstall Laravel/Valet from MacOS completely

Do the below and never try this again!

valet uninstall

composer global remove laravel/valet

sudo rm /usr/local/bin/valet

sudo rm -r ~/.valet

@YenLung-Huang
YenLung-Huang / 1_Laravel_state-machine.md
Created April 21, 2023 09:50 — forked from iben12/1_Laravel_state-machine.md
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.

@YenLung-Huang
YenLung-Huang / ResultSet to List
Created February 27, 2018 03:27 — forked from cworks/ResultSet to List
Java - Convert a ResultSet to a List of Maps, where each Map is a row of data
/**
* Convert the ResultSet to a List of Maps, where each Map represents a row with columnNames and columValues
* @param rs
* @return
* @throws SQLException
*/
private List<Map<String, Object>> resultSetToList(ResultSet rs) throws SQLException {
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>();