Taken from here: https://discord.com/channels/608064116111966245/608064116984250379/1055555451569328179
Have 2 terminals running. In the first, start a web server:
ruby -run -e httpd ./builds/mygame-html5-0.1
in the second terminal, run the build:
Taken from here: https://discord.com/channels/608064116111966245/608064116984250379/1055555451569328179
Have 2 terminals running. In the first, start a web server:
ruby -run -e httpd ./builds/mygame-html5-0.1
in the second terminal, run the build:
def draw_circle(args, diameter: 200) | |
diameter.times do |i| | |
r1 = diameter / 2 | |
h1 = i - r1 | |
l1 = Math::sqrt(r1 * r1 - h1 * h1) | |
r2 = r1 - 4 # Modify this to adjust the size of the inner circle. the bigger this is, the more empty space, the smaller, the less empty space. | |
h2 = (i - r2) - (r1 - r2) | |
if h2.abs < r2 | |
l2 = Math::sqrt(r2 * r2 - h2 * h2) |
// .dragonruby/stubs/html5/dragonruby-html5-loader.js | |
// ... | |
// end of dragonruby-html5-loader.js ... | |
// A silly hack for Safari browsers to get `window.open` to behave properly. | |
// The hack is fairly straightforward. We create a "hidden" anchor. When the user clicks on the page, if `window.open` gets called | |
// in a "click" event, it will set the `href` and `target` attributes on the anchor, and then when the `pointerup` finishes, reverts | |
// the override on `window.open` and remove the `href` and `target` attributes. | |
// | |
// As for "why" this works, Safari as part of "security", generally only expects `window.open` to be called in "click" and "click-like" |
;(() => { | |
// Make sure that all forms have actual up-to-date tokens (cached forms contain old ones) | |
function refreshCSRFTokens () { | |
const token = csrfToken() | |
const param = csrfParam() | |
if (token != null && param != null) { | |
document.querySelectorAll(`form input[name="${param}"]`).forEach(input => { | |
const inputEl = input | |
inputEl.value = token |
# Guide to parsing: https://randombits.dev/articles/number-localization/intro | |
# Table of data: https://randombits.dev/articles/number-localization/locale-list | |
# SCRIPT to grab from table of data: | |
# | |
=begin | |
;(() => { | |
const DECIMAL_SYMBOLS = { | |
"Period": ".", // U+002E | |
"Comma": ",", // U+002C | |
"Arabic Decimal Separator": "٫", // U+066B |
<template component="MyComponent" store="global"> | |
<div | |
@click="(e) => console.log('Clicked on: ' + this.name)" // event listeners | |
.name={{ name }} // properties | |
name="{{ name }}" // attributes | |
> | |
Hello {{ name }} | |
</div> | |
</template> |
const originalFetch = window.fetch | |
window.fetch = function (url, options = {}) { | |
if (url === "http://example.net/locale") { | |
return new Response(JSON.stringify({ | |
locale: "en-US", | |
timeZone: "UTC" | |
})) | |
} else { |
const selection = document.getSelection() | |
if (!selection) { return } | |
let hasNode = false | |
if (typeof selection.getComposedRanges === "function") { | |
const staticRange = selection.getComposedRanges(this.contentEditableElement.getRootNode())[0] | |
if (!staticRange) { return } |
# test/application_system_test_case.rb | |
require "test_helper" | |
require "playwright" | |
require "fileutils" | |
class CapybaraNullDriver < Capybara::Driver::Base | |
def needs_server? | |
true | |
end | |
end |