こちらから持ってきました
Google のソフトウェア・エンジニアリング
「書く」のは特別な道具
[例:作成するライブラリの名前は]
[何を実現するの?]
import Vue from 'vue'; | |
class Vue2Island extends HTMLElement { | |
constructor() { | |
super(); | |
this.vueInstance = null; | |
} | |
connectedCallback() { | |
this.name = this.dataset.name |
# user.rb | |
class User < ApplicationRecord | |
after_create_commit do | |
if is_admin? | |
AdminUserCreateLoggingJob.perform_later(self.id) | |
end | |
end | |
end | |
# ConditionをJobクラスに含めない |
// https://twitter.com/justin999_/status/1293738518989029379?s=21 | |
// | |
// 1万個のarrayを高速で作る方法を考えよ。 | |
// Swiftでいうなら、[[Int]]。 | |
// なお、それぞれのarrayの中身はランダム、長さは7である | |
// [ | |
// [1, 3, 9, 0, 1, 2, 4], | |
// [1, 9, 0, 7, 9 ,1, 2], | |
// ....(1万個) | |
// ] |
こちらから持ってきました
Google のソフトウェア・エンジニアリング
「書く」のは特別な道具
[例:作成するライブラリの名前は]
[何を実現するの?]
require "./emitter.rb" | |
Emitter.once("hello") do |param| | |
puts "Hello World #{param}" | |
end | |
Emitter.emit("hello", "param") | |
Emitter.emit("hello", "param2") |
<p id="notice"><%= notice %></p> | |
<h1>Users</h1> | |
<div data-controller="hello" data-hello-check-ids-value="[]"> | |
<table> | |
<thead> | |
<tr> | |
<th> | |
<input type="checkbox" data-action="hello#toggleCheckAllDisplayUsers"> |
class Message | |
attr_reader :id, :text | |
def initialize(id, text) | |
@id = id | |
@text = text | |
end | |
def self.find(messages, search_id) | |
# 2回目以降はインスタンス生成をしたくない。 |
import UIKit | |
import Foundation | |
var str = "Hello, playground" | |
struct Author: Codable { | |
var id: Int? | |
var name: String | |
var nickname: String? | |
} |
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
class MtParser | |
attr_reader :mt_records, :file_path, :is_parseing_body | |
def self.import | |
parser = new("#{Rails.root}/app/models/webuilder240.hatenablog.com.export.txt") | |
parser.parse | |
records = parser.mt_records | |
ActiveRecord::Base.transaction do | |
records.each do |mt_record| |