I hereby claim:
- I am sunny on github.
- I am sunfox42 (https://keybase.io/sunfox42) on keybase.
- I have a public key ASDTUFctmlgvsQC0k66qtvmcGhmcO_CtzpmW0D-cdx-xSAo
To claim this, I am signing this object:
const htmlFetch = async (url, { headers, body, ...options } = {}) => { | |
const token = document.querySelector('meta[name="csrf-token"]').content; | |
options = { | |
headers: new Headers({ | |
Accept: "text/html", | |
"Content-Type": "application/json", | |
"X-Requested-With": "XMLHttpRequest", | |
"X-CSRF-Token": token, | |
...headers, |
# frozen_string_literal: true | |
class Blog::ArticlePlanter < Planter | |
def check(slug_en:) | |
Blog::Article.where(slug_en: slug_en).any? | |
end | |
def create(params) | |
FactoryBot.create(:blog_article, params) | |
end |
import { Controller } from "stimulus"; | |
// Show/hide elements based on the value of a select element. | |
// | |
// Example: | |
// <div data-controller="select-definitions"> | |
// <select | |
// data-select-definitions-target="select" | |
// data-action="change->select-definitions#change" | |
// > |
# frozen_string_literal: true | |
# Self-contained, standalone Sinatra app usable to play with pagy | |
# and/or easily reproduce any pagy issue. | |
# Copy this file in your own machine and | |
# ensure rack is installed (or `gem install rack`) | |
# USAGE: | |
# rackup -o 0.0.0.0 -p 8080 pagy_standalone_app.ru |
I hereby claim:
To claim this, I am signing this object:
# config/initializers/i18n.rb | |
I18n::Backend::Simple.include(I18n::Backend::TranslateLocale) |
class ApplicationController < ActionController::Base | |
include I18nHelper | |
end |
require "benchmark" | |
require "rubygems" | |
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__) | |
require "bundler/setup" | |
# https://github.com/rubygems/rubygems/blob/a753447de8fb92dad30e927656984aa2b7765f3d/bundler/lib/bundler/runtime.rb#L46 | |
REQUIRE_ERRORS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, |
class ComputePrice < Actor | |
play ComputePricePerDay, | |
if: -> input { input.selected_at < Time.utc(2020, 9, 1) } | |
play ComputePricePerMinute, | |
if: -> input { Time.utc(2020, 9, 1) <= input.selected_at } | |
play ApplyDiscount, | |
if: -> input { Time.utc(2020, 6, 1) <= input.selected_at } | |
end | |
class ComputePricePerDay < Actor |
class Snail | |
include Enumerable | |
def initialize(data) | |
@data = data | |
@direction = :right | |
@x = 0 | |
@y = 0 | |
end |