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 RootScene < Scene | |
attr :game | |
def initialize | |
@game = Game.new | |
$game = @game | |
@world_scene = WorldScene.new | |
@embark_scene = EmbarkScene.new | |
@world_event_scene = WorldEventScene.new | |
@battle_scene = BattleScene.new |
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
# prototype extracted from the Practical Framework | |
class PracticalFramework::Components::TiptapDocument < Phlex::HTML | |
class UnknownNodeTypeError < StandardError; end | |
class UnknownMarkupTypeError < StandardError; end | |
module NodeRendering | |
def render_node(node:) | |
case node[:type].to_sym | |
when :text |
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
import {Controller} from '@hotwired/stimulus' | |
import {Editor} from "@tiptap/core" | |
import {Mention} from "@tiptap/extension-mention"; | |
import StarterKit from "@tiptap/starter-kit" | |
export default class extends Controller { | |
static targets = ['input', 'suggestions'] | |
connect() { | |
this.editor = new Editor({ |
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
import { navigator } from "@hotwired/turbo"; | |
import { Controller } from "stimulus"; | |
import { useMutation } from "stimulus-use"; | |
export default class extends Controller { | |
connect() { | |
useMutation(this, { attributes: true, childList: true, subtree: true }); | |
} | |
mutate(entries) { |
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
# l to toggle lines | |
# space to reset | |
# left click to attract | |
# right click to repel | |
$TIME_FACTOR = 1.0 | |
$X_WRAP = true | |
$Y_WRAP = true | |
# @param [GTK::Args] args | |
def tick(args) |
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
require "app/strings.rb" | |
def undo_last_stroke(args) | |
args.state.counts.pop | |
stroke = args.state.counts.pop | |
args.state.commands.slice!(0 - stroke, stroke) if stroke | |
end | |
def tick(args) | |
args.state.help_layer ||= :shown |
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
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
This gist is to configure a Mosquitto MQTT Broker behind a Traefik reverse-proxy, both in a docker container. Mosquitto will be configuread as a TCP Service.
This is a simple configuration used on the same single server. Probably to be adapted for other cases. Having mosquitto behind a reverse proxy enables you to configure TLS on Traefik (likely you already do that for other applications as well) and to load balance different MQTT instances, but that goes beyond this gist.
As noted in Traefik docs, in the router you must use the rule HostSNI(`*`)
when using non-TLS routers like in this example. Ref. https://docs.traefik.io/routing/routers/#rule_1
docker-compose.yml
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
-# layouts/_error_messages.html.haml | |
- if f.object.errors.any? | |
.notification.is-danger Please review the problems below: | |
- if f.object.errors[:base].present? | |
.notification.is-danger= f.object.errors[:base].join(', ') |
NewerOlder