分散協調サービス
部分障害を安全に処理できる分散アプリケーションを構築するための一連のツールを提供する
設定情報の集中管理や名前付けなどのサービスを提供する
ZooKeeperのアーキテクチャでは高可用性を冗長サービスにより提供している
クライアントはあるZooKeeperノードへの問い合わせが失敗したらほかのノードに問い合わせることができる
データの更新はマスターノードだけが行うようになっているので、データがノード間で矛盾した内容になることはない(ただし、最新のデータではない可能性はある)
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
/** | |
* node.jsを使った対話型コマンドラインツール | |
* node.jsはイベントループなので、他の言語のようにwhileで入力待ちしたりしなくていいのがすばらしい | |
* 入出力はreadlineを使う | |
*/ | |
var rl = require('readline'); // readline | |
var utl = require('util'); |
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
retry(async (abort, num) => { | |
const res = fetch('https://xxxx').then(res => res.json()); | |
if (condition) { | |
// 特定の条件の場合にリトライをしないで処理を抜ける場合はabortをコールする | |
abort(new Error('error message')); | |
} | |
}, {retryMax: 3, sleep: 300}); |
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
// pcでユーザーエージェントを偽装されてアクセスされていても、これである程度判定できるはず | |
function isTouchDevice() { | |
return ($.browser.mobile && (('createTouch' in document) || ('ontouchstart' in document)) && ('orientation' in window)); | |
} |
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 recursive_symbolize_keys! hash | |
if hash.is_a? Hash | |
hash.symbolize_keys! | |
hash.values.each {|h| recursive_symbolize_keys! h} | |
elsif hash.is_a? Array | |
hash.map {|v| recursive_symbolize_keys! v} | |
end | |
hash | |
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
brew install vim --override-system-vi --with-lua --with-ruby --with-python --with-python3 |
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
<?php | |
namespace SidekiqPush; | |
/** | |
* rubyのsidekiqのphp版クライアント | |
*/ | |
class Client { | |
private $redis; | |
private $namespace; |
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
githubで使われる用語集 |
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 'capistrano_colors' | |
require 'capistrano' | |
require 'capistrano/ext/multistage' | |
set :application, "app_name" | |
set :repository, "repo path" | |
set :scm, "git" | |
set :branch, "master" | |
set :deploy_via, :copy |
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
# -*- coding: utf-8 -*- | |
module SomeModule | |
def self.included(klass) | |
klass.send(:include, SomeModule::Methods) | |
klass.send(:extend, SomeModule::ClassMethods) | |
end | |
module Methods |
NewerOlder