Skip to content

Instantly share code, notes, and snippets.

View mkamakura's full-sized avatar

Masaya Kamakura mkamakura

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

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

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


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

興味ある方は twitter @mizchi へのリプライorDM、または mizchi2w@gmail.com まで。

@sebmarkbage
sebmarkbage / The Rules.md
Last active June 30, 2024 01:30
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 = [
"零時、深夜零時ですよぉ?"
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@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 }