Skip to content

Instantly share code, notes, and snippets.

View daichirata's full-sized avatar
🏠
Working from home

Daichi Hirata daichirata

🏠
Working from home
View GitHub Profile
@sandabu
sandabu / Example.php
Last active February 7, 2022 12:14
Stripe API Japanese Error Messages
<?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)) {
@voluntas
voluntas / saikyo.rst
Last active September 13, 2023 02:33
ぼくのかんがえたさいきょうの超低遅延大規模配信

ぼくのかんがえたさいきょうの超低遅延大規模配信

更新

2018-08-20

作者

@voluntas

バージョン

18.8.3

URL

https://voluntas.github.io/

@sile
sile / rfc.md
Last active June 2, 2022 15:19
Rustの『RFC 2033: 実験的なコルーチン』の要約メモ
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* 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 😨
@shimizukawa
shimizukawa / 201723133-Billing-FAQ.rst
Last active August 16, 2018 02:13
【Slack FAQ 翻訳】 2014/6/23 支払いFAQ - Billing FAQ - Slack Help Center
@yuroyoro
yuroyoro / compose.rb
Created August 3, 2012 03:26
なんでRubyで関数合成できねぇンだよ( ;゚皿゚)ノシΣ フィンギィィーーッ!!!
# 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")
@morygonzalez
morygonzalez / takagi.rb
Created July 5, 2012 01:58 — forked from siyo/takagi.rb
高木っぽいRT plugin.rb
# -*- 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}'")
@davidjrice
davidjrice / redcarpet.rb
Created June 29, 2012 00:34
Rails 3.2 Markdown Template Handler
# 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
@matope
matope / NoSQLデータモデリング技法.markdown
Created April 16, 2012 03:35
NoSQLデータモデリング技法

#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に感謝したいと思う