// jQuery
$(document).ready(function() {
// code
})
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
# This code is based on the code at blow: | |
# https://github.com/fastruby/fast-ruby/tree/main/code/enumerable | |
require "benchmark/ips" | |
ARRAY = [*1..100] | |
def fast | |
ARRAY.each.with_index(1) do |number, index| | |
index | |
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
source "https://rubygems.org" | |
gem "activerecord", '~> 7.0' | |
gem "sqlite3" |
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
const randomArray = (w, h, v) => { | |
const a = Array.from(Array(v), (_,k) => k) | |
let t = [] | |
for(let y=0; y<h; y++){ | |
t.push([]); | |
for(let x=0; x<w; x++){ | |
let g = t.map(r => r[x]).concat([t[y][x-1]]); | |
let f = a.filter(e => !g.includes(e)); | |
t[y][x] = f[Math.floor(Math.random()*f.length)]; | |
} |
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
# コンテナにログインする | |
docker ps | |
docker exec -it {CONTAINER ID} bash | |
# コンテナ削除 | |
docker ps -a -q | xargs docker rm | |
# イメージ削除(コンテナ削除後) | |
docker images -q | xargs docker rmi |
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
WORDPRESS_DB_NAME=wordpress | |
WORDPRESS_DB_USER={input user name} | |
WORDPRESS_DB_PASSWORD={input password} | |
MYSQL_RANDOM_ROOT_PASSWORD=yes | |
MYSQL_DATABASE=wordpress | |
MYSQL_USER={input user name} | |
MYSQL_PASSWORD={input password} |
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
def row_number(str) | |
str.bytes.reverse.each.with_index(0).reduce(0) do |n, (c, i)| | |
n += (26 ** i * (c.ord - 64)) | |
end | |
end | |
('A'..'BZ').each do |str| | |
p [str, row_number(str)] | |
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
require 'rack-proxy' | |
module SimulationSample | |
class Proxy < Rack::Proxy | |
def rewrite_env(env) | |
env | |
end | |
end | |
def self.call(env) |
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
def target_partial | |
Dir['app/views/front/{shared,sections,sidebar}/**/*'].each_with_object([]) do |f, list| | |
next unless File.file?(f) | |
list << [ | |
File.dirname(f).sub('app/views/', ''), | |
File.basename(f).sub(/^_/, '').sub('.slim', '').sub('.html.erb', '') | |
].join('/') | |
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
console.log('Loaded..'); | |
class Togglable { | |
constructor(th) { | |
this.th = th; | |
this.table = th.parentNode.parentNode.parentNode; | |
this.tds = this.table.querySelectorAll('td:nth-child(' + this._getColumnIndex(th) + ')') | |
} | |
toggle() { |
NewerOlder