Skip to content

Instantly share code, notes, and snippets.

Working from home

Yuya Tanaka ypresto

Working from home
View GitHub Profile
ypresto / .zshrc
Created May 31, 2020
Fix "SSL certificate problem: certificate has expired" issue in homebrew
View .zshrc
# Add this snippet to your .zshrc, .bashrc or etc.
export CURL_SSL_BACKEND=secure-transport
ypresto / docker-compose-mutagen.yml
Last active Feb 2, 2020
Use mutagen with docker-sync like setup.
View docker-compose-mutagen.yml
version: "3.7"
- your-app-mutagen-service1:/var/app:nocopy
- your-app-mutagen-service2:/var/app:nocopy
ypresto / settings-for-vscode-color.json
Last active Sep 9, 2019
Personally recommended color config for VSCode
View settings-for-vscode-color.json
"workbench.colorTheme": "One Dark Pro",
"workbench.colorCustomizations": {
"[One Dark Pro]": {
// Reduce brightness
"activityBar.background": "#1b1d23",
"badge.background": "#1b1d23",
"editor.background": "#1b1d23",
"sideBarSectionHeader.background": "#1b1d23",
"tab.activeBackground": "#1b1d23",
ypresto / backtrace_relative_path.rb
Last active May 30, 2019
Prepend specified path to backtrace in rspec output (for rails in subdirectory).
View backtrace_relative_path.rb
# NOTE: Put this file to spec/support/ .
# Prepend specified path to backtrace and Failure/Error section.
# Useful for multi module repository where rails is placed in the subdirectory.
# Intended for editors with click-to-open-file feature.
# For example
# # ./spec/models/your_model_spec.rb:12:in `your_method'
# to
# # ./rails/spec/models/your_model_spec.rb:12:in `your_method'
ypresto / safari-11-file-xhr-workaround.js
Last active May 11, 2018
[Does NOT work in Firefox] iOS 11.3 Safari / macOS Safari 11.1 empty <input type="file"> XHR bug workaround for rails-ujs / jquery_ujs
View safari-11-file-xhr-workaround.js
// iOS 11.3 Safari / macOS Safari 11.1 empty <input type="file"> XHR bug workaround.
// Replace empty File object with equivalent Blob in FormData, keeping its order, before sending it to server.
// Should work with IE10 and all other modern browsers.
// Because useragent value can be customized by WebView or etc., applying workaround code for all browsers.
document.addEventListener('ajax:beforeSend', function(e) {
var formData = e.detail[1].data
if (!(formData instanceof window.FormData)) return
if (!formData.keys) return // unsupported browser
ypresto / safari-11-file-xhr-workaround-2.js
Last active Sep 6, 2018
iOS 11.3 Safari / macOS Safari 11.1 empty <input type="file"> XHR bug workaround for rails-ujs / jquery_ujs
View safari-11-file-xhr-workaround-2.js
// iOS 11.3 Safari / macOS Safari 11.1 empty <input type="file"> XHR bug workaround.
// This should work with every modern browser which supports ES5 (including IE9).
document.addEventListener('ajax:before', function(e) {
var inputs ='input[type="file"]:not([disabled])')
inputs.forEach(function(input) {
if (input.files.length > 0) return
input.setAttribute('data-safari-temp-disabled', 'true')

Keybase proof

I hereby claim:

  • I am ypresto on github.
  • I am ypresto ( on keybase.
  • I have a public key ASBiAns4kqBa5eKu8wuHbtMxxMxV675BuMcbDtVlY93JBwo

To claim this, I am signing this object:

ypresto / init.lua
Last active Mar 1, 2018
View init.lua
local pressedKeyTable = {}
-- TODO: Consider about consumed per keys is necessary or not.
local consumed = false
local keyCodeTable = {}
keyCodeTable[0x66] = true -- EISUU
keyCodeTable[0x68] = true -- KANA
eventtap ={ hs.eventtap.event.types.keyDown, hs.eventtap.event.types.keyUp }, function(event)
local keyCode = event:getKeyCode()
if keyCodeTable[keyCode] == true then
ypresto /
Last active Jan 14, 2020
Gson adapter for Android's Uri class.
ypresto / YPLayoutGuideHelper.m
Last active Apr 20, 2020
Apply automaticallyAdjustsScrollViewInsets in child view controller like Container View or UIPageViewController
View YPLayoutGuideHelper.m
// YPLayoutGuideHelper.m
// Created by Yuya Tanaka, 2015
// This is free and unencumbered software released into the public domain.
// Refer:
// automaticallyAdjustsScrollViewInsets doesn't work for child view controllers
// hosted by something like Container View or UIPageViewController.
You can’t perform that action at this time.