This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This gist was erased. | |
// I recommend you to take a closer look at my new cli-tool: | |
// | |
// https://packagist.org/packages/axenov/pm-convert | |
// | |
// It can convert multple collections v2.1 to http/wget/curl formats | |
// very quickly and without 3rd-party dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# GoLang installer | |
# https://golang.org/doc/install | |
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu | |
# if [ "$EUID" -ne 0 ] | |
# then echo "*** root permissions required ***" | |
# exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function output(...$data) | |
{ | |
$result = []; | |
foreach ($data as $something) { | |
if ($something instanceof Illuminate\Support\Collection) { | |
$something = $something->toArray(); | |
} | |
if (is_array($something)) { | |
$something = var_export($something, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types = 1); | |
namespace Tests; | |
use Illuminate\Support\Collection; | |
use PHPUnit\Framework\TestCase; | |
class BasicTestCase extends TestCase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################################################### | |
# # | |
# Set display resolution # | |
# # | |
# Author: Anthony Axenov (Антон Аксенов) # | |
# Version: 1.0 # | |
# License: WTFPL # | |
# # | |
######################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################################################### | |
# # | |
# Argument parser for bash scripts # | |
# # | |
# Author: Anthony Axenov (Антон Аксенов) # | |
# Version: 1.5 # | |
# License: MIT # | |
# # | |
######################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original: https://gist.github.com/akostadinov/33bb2606afe1b334169dfbf202991d36 | |
# The difference is that this func outputs stacktrace in reverse order (from top level to lower ones) | |
function print_stacktrace () { | |
STACK="" | |
local i | |
local stack_size=${#FUNCNAME[@]} | |
echo "Stacktrace:" | |
# skip this function and "MAIN non_file_source:0" | |
for (( i=$stack_size-1; i>=1; i-- )); do | |
local func="${FUNCNAME[$i]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple php equivalent of Oracle's coalesce() | |
* | |
* It can be used as simple oneline-alternative to switch or if operators in many | |
* cases without difficult logic. For example, get first non-empty value from bunch of vars: | |
* | |
* echo coalesce($var1, $var2, $var3, ...); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple php equivalent of Oracle's decode() | |
* | |
* It can be used as simple oneline-alternative to switch or if operators in many | |
* cases without difficult logic. For example, get string mnemocode of some value: | |
* | |
* echo 'State: '.decode($state, 0, 'disabled', 1, 'enabled', 'unknown'); | |
* |