This file contains hidden or 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
FROM serversideup/php:8.3-fpm-nginx-alpine AS base | |
ENV AUTORUN_ENABLED=1 | |
ENV PHP_OPCACHE_ENABLE=1 | |
ENV SSL_MODE="off" | |
USER root | |
RUN apk add --update busybox-suid && \ | |
install-php-extensions bcmath gd exif |
This file contains hidden or 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 is the blockchain example from The Imposter's Handbook Season 2 book. | |
class Block | |
{ | |
public static function mine(array $transactions, float $timestamp, int $difficulty, ?Block $previous = null) | |
{ | |
if ($difficulty < 2) throw new \Exception("This isn't much of a challenge"); | |
if ($difficulty > 18) throw new \Exception("Do polar icecaps matter to you?"); |
This file contains hidden or 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
# Pseudo-code based on the PHP version... | |
namespace :action_text do | |
task refresh_embeds: :environment do | |
ActionText::RichText.where.not(body: nil).find_each do |trix| | |
next unless trix.embeds.size.positive? | |
trix.update_column :body, trix.body.fragment.replace("action-text-attachment[sgid]") do |node| | |
return ActionText::Attachment.from_attachable( | |
GlobalID::Locator.locate_signed( |
This file contains hidden or 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 binary_search(array $items, $lookingFor) { | |
$min = 0; | |
$max = count($items); | |
while ($min <= $max) { | |
$middle = $min + intval(floor($max - $min) / 2); | |
if ($items[$middle] === $lookingFor) { |
This file contains hidden or 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
<x-app-layout title="New Invitations"> | |
<h1>New Invitations!</h1> | |
<form action="{{ route('invitations.store') }}" method="POST"> | |
<div id="invitations"></div> | |
<button type="submit">Invite</button> | |
</form> | |
<x-turbo-frame id="create_trigger_invitations"> |
This file contains hidden or 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 | |
class Queen | |
{ | |
private int $row; | |
public function __construct(private int $column, private ?Queen $neighbour) | |
{ | |
$this->row = 1; | |
} |
This file contains hidden or 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
# Configuring Git | |
git config --global credential.helper store | |
echo "https://${GITHUB_TOKEN}:[email protected]" > "${HOME}/.git-credentials" | |
hub config --global hub.protocol https | |
hub config --global user.name "${GITHUB_NAME}" | |
hub config --global user.email "${GIT_EMAIL}" | |
# Cloning the infrastructure repository | |
hub clone ${GIT_REPO} infrastructure-repo | |
cd infrastructure-repo |
This file contains hidden or 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
kustomize edit set image laravel-app-php=tonysm/docker4laravelapp-php:1.0.0 |
This file contains hidden or 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
name: Build Docker Images | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest |
This file contains hidden or 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
const app = express() | |
const port = 3000 | |
-app.get('/', (req, res) => res.send('Hello World!')) | |
+app.get('/', (req, res) => res.send('Hello World 2.0.0!')) | |
app.listen(port, () => console.log(`Example app listening on port ${port}!`)) |
NewerOlder