- 更新
2018-08-20
- 作者
@voluntas
- バージョン
18.8.3
- URL
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 | |
//Composerでstripe/stripe-php をrequire済み | |
require_once __FILE__. './jp.php'; | |
try{ | |
Stripe\Stripe::setApiKey('sk_test_YOUR_KEY'); | |
Stripe\Charge::create([]); | |
}catch(Stripe\Error\Base $e) { | |
$err = $e->getJsonBody()['error']; | |
if(key_exists('code', $err)) { |
- Start Date: 2017-06-15
- RFC: https://github.com/rust-lang/rfcs/blob/master/text/2033-experimental-coroutines.md
- PR: rust-lang/rfcs#2033
- Issue: rust-lang/rust#43122
関連: RFC 2394
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
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |
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
# Rubyで関数合成 | |
# | |
# irb(main):016:0> f = "foo".method(:==) | |
# => #<Method: String#==> | |
# irb(main):017:0> g = lambda{|x| puts "result : #{x}"} | |
# => #<Proc:0x007fdafa06c0c0@(irb):17 (lambda)> | |
# irb(main):018:0> (f >> g).call("foo") | |
# result : true | |
# => nil | |
# irb(main):019:0> (f >> :to_s).call("hoge") |
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 -*- | |
# takagi RT | |
# | |
# e.g. :takagi $xx | |
# | |
Earthquake.init do | |
command %r|^:takagi\s+(\d+)$|, :as => :takagi do |m| | |
st = cache.read("status:" + m[1]) | |
text = sprintf("だったら黙ってろクソが RT @%s %s" % [st["user"]["screen_name"], st["text"]]) | |
async_e { twitter.update(text, :in_reply_to_status_id => m[1]) } if confirm("update '#{text}'") |
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
# config/initializers/redcarpet.rb | |
module ActionView | |
module Template::Handlers | |
class Markdown | |
class_attribute :default_format | |
self.default_format = Mime::HTML | |
def call(template) | |
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true) | |
markdown.render(template.source).html_safe.inspect |
基礎知識
読み物系
#NoSQLデータモデリング技法
原文:NoSQL Data Modeling Techniques « Highly Scalable Blog
I translated this article for study. contact matope[dot]ono[gmail] if any problem.
NoSQLデータベースはスケーラビリティ、パフォーマンス、一貫性といった様々な非機能要件から比較される。NoSQLのこの側面は実践と理論の両面からよく研究されている。ある種の非機能特性はNoSQLを利用する主な動機であり、NoSQLシステムによく適用されるCAP定理がそうであるように分散システムの基本的原則だからだ。一方で、NoSQLデータモデリングはあまり研究されておらず、リレーショナルデータベースに見られるようなシステマティックな理論に欠けている。本稿で、私はデータモデリングの視点からのNoSQLシステムファミリーの短い比較といくつかの共通するモデリングテクニックの要約を解説したい。
本稿をレビューして文法を清書してくれたDaniel Kirkdorfferに感謝したいと思う
NewerOlder