Skip to content

Instantly share code, notes, and snippets.

View mkamakura's full-sized avatar

Masaya Kamakura mkamakura

  • self employed
  • Tokyo/Japan
  • 20:03 (UTC +09:00)
View GitHub Profile

最新のステータス: 追記: 2019/7/10

転職しました。長らくのご愛顧誠にありがとうございました。


転職先をちょくちょく探しています。

興味ある方は twitter @mizchi へのリプライorDM、または [email protected] まで。

@sebmarkbage
sebmarkbage / The Rules.md
Last active October 25, 2025 11:39
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

// Usage:
// <div>
// <GlobalKeyListner keyCode={13} handler={() => console.log('Enter')}/>
// </div>
export default class GlobalKeyListner extends React.Component {
type = 'keydown'
componentDidMount() {
const keyCode = this.props.keyCode
this._bound = (ev: SyntheticEvent) => {
if (ev.keyCode === keyCode) {
@mikesorae
mikesorae / makigumo_bot.coffee
Created September 9, 2014 15:53
hubot用 巻雲時報 & ランダムメッセージスクリプト
# Description:
# 巻雲がしゃべるだけのbot
#
# Commands:
# hubot
Cron = require('cron').CronJob
JIHOU_MESSAGES = [
"零時、深夜零時ですよぉ?"
@tim-peterson
tim-peterson / Go Revel nginx.conf
Last active March 10, 2018 04:10
Revel Framework nginx.conf to make Revel app work outside of localhost, i.e., on my live, personal-website.com
http{
index index.html;
server {
listen 80;
root /gocode/src/personalwebsiteapp;
server_name personal-website.com;
@cyberdelia
cyberdelia / fabfile.py
Created April 3, 2010 14:05
Fabric deploy script with : south migrations, rollback and maintenance page.
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }