$ sudo mkdir -p /opt/Obsidian
$ mv ~/Downloads/Obsidian-0.13.19.AppImage /opt/Obsidian
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
#!/usr/bin/env bash | |
set -euo pipefail | |
# Ref: | |
# * https://stackoverflow.com/a/44992513 | |
# * https://github.com/jwiegley/git-scripts/blob/master/git-pr | |
test -z $1 && echo "Merge request number required." 1>&2 && exit 1 | |
git fetch ${2:-origin} merge-requests/$1/head:mr-$1 && git checkout mr-$1 |
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 | |
$client = new GuzzleHttp\Client(); | |
// Ref: https://guzzle.readthedocs.io/en/latest/request-options.html#sink-option | |
$client->request('GET', 'http://example.com', [ | |
'sink' => '/tmp/' . sha1(file_get_contents('https://example.com')) | |
]); |
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 | |
namespace App\Logging; | |
use DateTimeZone; | |
use Monolog\Logger; | |
use App\Logging\TelegramBotHandler; | |
use Monolog\Formatter\LineFormatter; | |
class FooLogger |
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 | |
/** | |
* Example: five_star_rating_stars(4.8); | |
* five_star_rating_stars( | |
* 4.8, | |
* '<i class="fas fa-star"></i>', | |
* '<i class="fas fa-star-half-alt"></i>', | |
* '<i class="far fa-star"></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 | |
function change_make($price, $pay) | |
{ | |
if ($price === 0 || $pay === 0 || $price > $pay) { | |
return; | |
} | |
$change = $pay - $price; |
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 | |
use App\Models\Member; | |
abstract class AbstractCalculator | |
{ | |
/** @var self */ | |
private $next = null; | |
/** |
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 | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Media extends Model {} |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
# Ref: Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html | |
aws ec2 describe-images \ | |
--owners 099720109477 \ | |
--filters "Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-*" \ | |
"Name=architecture,Values=x86_64" \ | |
"Name=virtualization-type,Values=hvm" \ | |
"Name=root-device-type,Values=ebs" |
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 | |
if ( ! wp_roles()->is_role( 'my_customer' ) ) { | |
add_role( | |
'my_customer', | |
__( 'My customer' ), | |
array_merge( | |
wp_roles()->get_role( 'customer' )->capabilities, | |
array( 'read_shop_order', 'read_private_shop_orders' ) | |
) |
NewerOlder