Skip to content

Instantly share code, notes, and snippets.

View yasaichi's full-sized avatar
😇

Yuichi Goto yasaichi

😇
View GitHub Profile

明日の下書き


これはなに

  • 高円寺.dev #3 用の資料 https://koenji.connpass.com/event/160886/
  • フロントエンド専門じゃない人向けの、フロントエンドの最先端〜やや未来の話です
  • このレイヤーでは Node.js を使うべき/使うと強いという部分がありますが、他言語を否定しているわけではありません。むしろ他言語でこのアーキテクチャを模倣してほしいという話です。
@katzchang
katzchang / README.md
Last active September 28, 2022 13:42
Steve Freeman氏とのペアプロ雑感 #tddbc

Steve Freeman氏とのペアプロ雑感

http://tddbc.doorkeeper.jp TDD Boot Camp 2013-07 -- TDDBC で、偶然にもロンドンから来日していたSteve Freeman氏を招くことができた。ちなみに本当に偶然の来日で、その日の夕方にご家族と隅田川の花火を見る予定だったらしい。貴重な時間である。

20分ほど講演していただき、さらに参加者と一緒にペアプロ課題に挑戦してもらった。しかもペアプロでっていう貴重な体験をさせてもらったので、そのことについてまとめたい。

Steve Freeman氏は書籍 "Growing Object-Oriented Software, Guided by Tests" (邦訳「実戦テスト駆動開発」)の共著者の一人で、Javaのモックフレームワーク "JMock"の開発者の一人。当然、自動販売機の課題にもJMockを駆使してモデリングしていただくことになった。

Start from the outside

@fdaciuk
fdaciuk / lazy-img.jsx
Last active December 8, 2022 18:38
React Lazy img load component
'use strict'
import React, { Component } from 'react'
import PropTypes from 'prop-types'
class LazyImg extends Component {
constructor () {
super()
this.state = { loaded: false }
this.img = {}

マージ済みのリモートブランチを全て削除

git branch -r --merged master | grep -v -e master -e develop | sed -e 's% *origin/%%' | xargs -I% git push --delete origin %
  1. remote の master に merge済み の branch をすべて表示して
  2. master と develop は消えてほしくないので除外して
  3. origin/ を削除して
  4. xargs (-I% % で ブランチ名を渡しつつ、全て削除する)
@dhh
dhh / test_induced_design_damage.rb
Last active June 22, 2023 06:18
This is an extraction from Jim Weirich's "Decoupling from Rails" talk, which explained how to apply the hexagonal design pattern to make every layer of your application easily unit testable (without touching the database etc). It only seeks to extract a single method, the EmployeesController#create method, to illustrate the design damage that's …
# Original Rails controller and action
class EmployeesController < ApplicationController
def create
@employee = Employee.new(employee_params)
if @employee.save
redirect_to @employee, notice: "Employee #{@employee.name} created"
else
render :new
end

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically 10.211.55.2.

@eparreno
eparreno / sidekiq_delete_jobs.md
Last active September 5, 2023 17:38
How to delete Sidekiq jobs in a Rails app using ActiveJobs

How to delete Sidekiq jobs in a Rails app using ActiveJobs

Sidekiq jobs can be enqueued or scheduled. Enqueued means that they are gonna be picked up as soon as possible, scheduled jobs will be enqueued at some specific time.

job_id and jid

When using ActiveJobs, Rails will return a job_id after sending the job to ActiveJobs

job = UserMailer.send_invite(params).deliver_later
@waaaaRapy
waaaaRapy / totp.js
Last active November 10, 2023 03:28
Time-Based One-Time Password Generator (RFC6238)
// work on node v10.15.3
const DIGIT = 6;
const TIME_STEP = 30;
/**
* Calculate TOTP value defined in [RFC6238](https://tools.ietf.org/html/rfc6238)
*
* @param {Buffer} key shared secret between client and server
* @param {Date} date date to calculate totp value.
@necojackarc
necojackarc / Set up Vim with clipboard on Ubuntu on WSL2.md
Last active December 28, 2023 02:45
Set up Vim on Ubuntu on Windows Subsystem for Linux 2 (WSL2) to share clipboard

This explains how to set up Vim on Ubuntu 18.04 on Windows Subsystem for Linux 2 (WSL2) in order to share the clipboard between Windows and Ubuntu.

Environments

  • Windows 10 Home
  • Ubuntu 18.04 on Windows Subsystem for Linux 2 (WSL2)

Steps

  1. Build Vim with the clipboard option enabled
  2. Set up VcXsrv Windows X Server