Skip to content

Instantly share code, notes, and snippets.

@ainoya
ainoya / stripe_error_ja.json
Created December 30, 2020 03:19
stripe errors Japanese translated
{
"account_already_exists": "アカウントがすでに存在します",
"account_country_invalid_address": "アカウントの国籍とビジネスを行う国籍が異なります",
"account_invalid": "アカウントが不正です",
"account_number_invalid": "口座番号が不正です",
"alipay_upgrade_required": "Alipayのアップデートが必要です",
"amount_too_large": "金額が多すぎます",
"amount_too_small": "金額が少なすぎます",
"api_key_expired": "APIキーが失効しています",
"balance_insufficient": "残高不足です",
@ainoya
ainoya / wf.md
Created November 9, 2017 02:08
td wfコマンドをdockerfileに含めたい
FROM vixns/java8

RUN  cp -p /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

RUN apt-get -y update && apt-get -y install wget unzip mysql-client ftp ruby ruby-msgpack ruby-yajl libmysqld-dev libmysqlclient-dev ruby-dev gcc build-essential
RUN gem install rake td mysql2

ARG TD_API_KEY=${TD_APIKEY}
RUN echo 'Y' | td wf
@ainoya
ainoya / utf8-mac-matcher.rb
Created July 28, 2016 06:52
matcher for comparing string as uf8-mac coded string in test iOS app via appium
RSpec::Matchers.define :eq_as_utf8_mac do |expected|
match do |actual|
actual.force_encoding('UTF8-MAC') === expected.encode('UTF8-MAC')
end
end
expected = 'ぱぴぷぺぽ'
# actual = 'ぱぴぷぺぽ' gots from iOS App through appium server.
expect(find(actual).name.strip)
@ainoya
ainoya / simple_daemon_restarts_regularly.rb
Created July 28, 2016 06:49
damonize process and restart regularly
#!/usr/bin/env ruby
require 'rufus-scheduler'
$stdout.sync = true
scheduler = Rufus::Scheduler.new
def exec_command(cmd)
IO.popen(cmd) do |io|
while (line = io.gets) do
@ainoya
ainoya / parallel_appium.rb
Created July 28, 2016 06:46
start appium server in parallel
require 'selenium-webdriver'
require 'logger'
class AppiumServer
def initialize(opts = {})
@port = Selenium::WebDriver::PortProber.above(3000)
@log = ::Logger.new(STDOUT)
end
def start
@ainoya
ainoya / select.go
Created August 12, 2015 11:28
golang select receives close signal anyway
package main
import "fmt"
func main() {
var a chan struct{}
fmt.Println("Hello, playground")
a = make(chan struct{})
@ainoya
ainoya / wait.rb
Created July 19, 2015 17:30
wait
def wait? &block
i = 1
while i < 5 do
block.call(i)
sleep 0.2
i = i+1
end
end
@ainoya
ainoya / extensions.swift
Created July 13, 2015 06:14
Iterate the values of Enum type with Swift1.2
enum SoundEffectType:Int {
case Whitsle = 0,
Finish,
CDThree,
CDTwo,
CDOne,
CDGo,
Good,
Great,
Excellent,
@ainoya
ainoya / SKAction+Extensions.swift
Created July 12, 2015 18:46
Swift Extensions for SKAction.playSoundFileNamed() with custom volume
// reference: https://github.com/pepelkod/iOS-Examples/blob/master/PlaySoundWithVolume/PlaySoundWithVolumeAction.m
import SpriteKit
public extension SKAction {
public class func playSoundFileNamed(fileName: String, atVolume: Float, waitForCompletion: Bool) -> SKAction {
let nameOnly = fileName.stringByDeletingPathExtension
let fileExt = fileName.pathExtension
@ainoya
ainoya / application.conf
Created May 29, 2015 02:06
play2.4/slick3/mysql database configuration
slick {
default="infra.dao.*"
dbs {
default {
driver="slick.driver.MySQLDriver$"
db {
driver=com.mysql.jdbc.Driver
url="jdbc:mysql://127.0.0.1:3306/dev?useUnicode=true&characterEncoding=UTF-8"