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
# FallbackStiToBase | |
# | |
# This concern provides a customizable fallback mechanism for Single Table Inheritance (STI) in Rails. | |
# It allows specifying which types should raise an error when not found, while others fallback to the base class. | |
# | |
# Usage: | |
# class Action < ApplicationRecord | |
# include FallbackStiToBase | |
# validates :type, presence: true, inclusion: { in: %w[Value1 Value2 Value3] } | |
# fallback_excluded_types 'RemovedValue1', 'RemovedValue2' |
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
module Types | |
class AppendSuffixType < ActiveRecord::Type::String | |
def initialize(suffix) | |
@suffix = suffix.to_s | |
end | |
def cast_value(value) | |
value.to_s + @suffix unless value.nil? | |
end |
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
# setup | |
docker buildx create --use --platform=linux/amd64,linux/arm64,linux/arm/v7 --name multi-platform-builder | |
docker buildx inspect --bootstrap | |
# actual build | |
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v7 -t streampot/server . | |
# do push | |
docker push streampot/server:latest |
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
class StreamPot { | |
num = 0; | |
doIt() { | |
this.num += 42; | |
return this; | |
} | |
} | |
const streamPotFactory = () => new Proxy(new StreamPot, { | |
get: (target, prop, receiver) => { |
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
# Set default values | |
repository="git@github.com:user/project.git" | |
branch="main" | |
new_release=$(date '+%s') | |
set -e | |
mkdir -p releases | |
cd releases || exit 1 | |
function deploy() { |
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\Rector; | |
use Illuminate\Routing\Controller; | |
use PhpParser\Node; | |
use PhpParser\Node\Stmt\Class_; | |
use Rector\Core\Rector\AbstractRector; | |
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; | |
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; |
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
/** | |
* Re-creates all <template> tags within <svg> elements as "DOM" elements to overcome browser limitations. | |
* This is necessary because HTML tags inside an SVG element have an SVG namespace, which may lack proper support. | |
* https://github.com/whatwg/html/issues/3563 | |
* https://github.com/alpinejs/alpine/issues/637#issuecomment-654856538 | |
*/ | |
const recreateTemplates = (templates: NodeListOf<Element>) => { | |
let el: Element, | |
template: HTMLTemplateElement, | |
attrs: NamedNodeMap, |
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
{ | |
"ignored_packages": | |
[ | |
"Vintage", | |
], | |
"color_scheme": "Packages/Inspired GitHub Color Scheme/InspiredGitHub.tmTheme", | |
"font_face": "IBM Plex Mono", | |
"font_size": 20, | |
"line_padding_top": 10, | |
"line_padding_bottom": 10, |
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
ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o/lib/libcrypto.dylib /usr/local/lib/ |
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
docker run \ | |
--name postgres15 \ | |
-p 5432:5432 \ | |
-e POSTGRES_USER=postgres \ | |
-e POSTGRES_PASSWORD=postgres \ | |
-e POSTGRES_DB=justpgdb \ | |
-v pgdata:/var/lib/postgresql/data \ | |
-d \ | |
postgres:15 |
NewerOlder