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
# create myapp_web/plugs/htmx.ex | |
defmodule MyAppWeb.Plugs.Htmx do | |
import Plug.Conn | |
import Phoenix.Controller, only: [put_root_layout: 2, put_layout: 2, root_layout: 1, layout: 1] | |
@behaviour Plug | |
@impl true | |
def init(opts), do: opts |
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
Mix.install([{:playwright, "~> 1.18.0-alpha.1"}]) | |
Playwright.CLI.install_deps() | |
Playwright.CLI.install() | |
browser = Playwright.launch() | |
page = browser |> Playwright.Browser.new_page() | |
page |> Playwright.Page.goto("https://google.com") |
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.exports = { | |
apps: [ | |
{ | |
name: "remix-pm2-test", | |
exec_mode: "cluster", | |
instances: "max", | |
cwd: "./", | |
script: "./node_modules/.bin/remix-serve", | |
args: "build", | |
watch: ["./"], // または true |
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
terraform { | |
required_providers { | |
digitalocean = { | |
source = "digitalocean/digitalocean" | |
version = "~> 2.0" | |
} | |
} | |
} | |
# Set the variable value in *.tfvars file |
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
# base dockerfile from https://github.com/evilmartians/terraforming-rails/blob/567566348a6a9893e10b9f857f1e5e58ba581b41/examples/dockerdev/.dockerdev/Dockerfile | |
# See explanation below | |
ARG RUBY_VERSION | |
FROM quay.io/evl.ms/fullstaq-ruby:$RUBY_VERSION-jemalloc-buster-slim as builder | |
ARG PG_MAJOR | |
ARG NODE_MAJOR | |
ARG BUNDLER_VERSION |
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 api/index.go | |
package handler | |
import ( | |
"net/http" | |
"github.com/labstack/echo/v4" | |
"github.com/labstack/echo/v4/middleware" | |
) |
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
# lib/tasks/active_storage.rake | |
require 'google/cloud/storage' | |
namespace :active_storage do | |
desc 'create bucket' | |
task :create_bucket, [:bucket_name, :domain] => :environment do |task, args| | |
storage.create_bucket(args.bucket_name, location: 'us-east1') do |b| | |
b.cors.add_rule ["http://#{args.domain}", "https://#{args.domain}"], | |
'*', |
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
= image_tag '', class: 'avatar width-full height-full', data: { controller: 'avatar', 'avatar-seed': user.name } |
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 TrackDecorator | |
include Twitter::TwitterText::Autolink | |
include Rails.application.routes.url_helpers | |
def body | |
# https://github.com/twitter/twitter-text/blob/752b9476d5ed00c2ec60d0a6bb3b34bd5b19bcf9/rb/spec/autolinking_spec.rb#L687-L689 | |
html = auto_link_hashtags(raw_body, { :hashtag_url_block => lambda { |url| project_path(self.project) } , hashtag_class: 'Label Label--gray'}) | |
raw html | |
end | |
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
!!! | |
%html | |
%head | |
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/ | |
%title Idone.today | |
= csrf_meta_tags | |
= csp_meta_tag | |
= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' | |
= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' | |
%body.bg-gray{ data: { controller: 'emoji-parser'} } |
NewerOlder