- HTTP/2
- Accept-Encoding: gzip, brotli
- Cache-Control
- その DB ロックは Redis に移せないか
- IN と JOIN どっちが早いか
- 静的ファイル gzip した?
- stackprof した?
- ベンチマーカーのリクエストヘッダ全部みた?
- pprof した?
- 全台使い切ってる?
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
#!/bin/bash | |
set -ex | |
find $HOME/Downloads -mtime +3 ! -type d -delete | |
find $HOME/Downloads -type d -empty -delete | |
# with cron | |
# * * * * * bash $HOME/bin/download-clear |
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 { Compilation, Compiler, sources } from 'webpack'; | |
interface Options { | |
filename: string; | |
} | |
interface Manifest { | |
[key: string]: string[]; | |
} |
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
# frozen_string_literal: true | |
class ApplicationRecord < ActiveRecord::Base | |
self.abstract_class = true | |
# List all model classes | |
def self.models | |
@models ||= begin | |
models = [] | |
Rails.root.join('app', 'models').glob('**/*.rb') do |path| |
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
#!/usr/bin/perl -- | |
use strict; | |
use warnings; | |
use utf8; | |
# mastodonのdockerコンテナの rails console はreadline がUS-ASCIIなので、文字列リテラルはエスケープが必要 | |
sub escapeNonAscii($){ | |
my($a) = @_; | |
$a =~ s/([\x{80}-\x{fffff}])/"\\u{".sprintf("%x",ord $1)."}"/ge; | |
$a; |
リポジトリにやったことは書いてあるし、今回やらなかったことは出来なかったことなので省略。
いくつか思い出深いものだけ言及していく。
- c9248d474db448e5367084abf42a333049abed09: 手元でもリモートの画像が出るようにした。手元に全部の画像持ってくるのは無駄だと思ったので。これは案外重要で、スクロール幅によってページングリクエストが発火されるので、手元の試験時に大事になる。
- fc8e55da988972826cfbed938ed2c603ee4346da: これもそう。存在しない localhost がデフォルトである価値はない。最初から用意されてるモックサービスを見に行くように。開発をしやすくしておく、というのを初手に打てるようになると、6年目で落ち着いてきたなと思わなくもない。
- f70d520bf123d19a6aec7874d10d4db10abac2fd: クエリを JOIN に。あとから思えば IN で別引きしたほうが items のロックに巻き込まれなかったなと思う。反省点。
- 35a525a95c9bdd063acf89c060471d35774eac2e: このへんで外部 API へのリクエストがヘビーだと気づいて Redis にキャッシュし始める。実際効果はあった。この時点で13:1頃。
I hereby claim:
- I am rosylilly on github.
- I am rosylilly (https://keybase.io/rosylilly) on keybase.
- I have a public key ASDXu2zmeAhbqsBCB6g3d2j_xpXno9PUlRSpbqelCQXFyQo
To claim this, I am signing this object:
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
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'pathname' | |
require 'yaml' | |
VERSION = '0.0.1' | |
HOMEDIR = Pathname.new(ENV['HOME']) | |
options = { |
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
# frozen_string_literal: true | |
class PartialValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
return if options[:if] && !valuable(record, options[:if]) | |
return if options[:unless] && valuable(record, options[:unless]) | |
value.validate | |
value.errors.messages.each_pair do |attr, messages| | |
messages.each do |message| |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>JS TEST</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
(function() { | |
"use strict"; |
NewerOlder