Skip to content

Instantly share code, notes, and snippets.

View tadyjp's full-sized avatar

tady (GitHub) tadyjp

View GitHub Profile
@tadyjp
tadyjp / zsh-prompt.sh
Created December 4, 2019 00:42
zsh prompt
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "!"
zstyle ':vcs_info:git:*' unstagedstr "+"
zstyle ':vcs_info:*' formats "%c%u:%b"
zstyle ':vcs_info:*' actionformats '%b:%a'
precmd() { vcs_info }
PROMPT_SEPARATOR=$'\u2b80'
@tadyjp
tadyjp / Gemfile
Last active October 4, 2017 15:22
AWS Elasticsearch Serviceが律儀にgzipを返すようになって死んだ [解決済み] ref: http://qiita.com/tady/items/eb924cc06e8c1ed5ae9a
...
gem 'faraday_middleware'
...
@tadyjp
tadyjp / Dockerfile
Last active August 20, 2017 12:20
RustでFREETELのギガ数を取得してInfluxDBにいれてGrafanaで見るまで ~ Dockerに添えて ~ ref: http://qiita.com/tady/items/b58a1e469e73268d0716
FROM rust:1.19.0
RUN apt-get update && apt-get install -y pkg-config libssl-dev
RUN mkdir -p /opt/rust
WORKDIR /opt/rust
CMD ["sh", "-c", "tail -f /dev/null"]
@tadyjp
tadyjp / file0.js
Last active November 7, 2016 09:53
JavaScriptでなぜ Object.create(null) を使うのか? ref: http://qiita.com/tady/items/1215a801e178c98deb35
var a = {}
var b = Object.create(Object.prototype)
@tadyjp
tadyjp / RubyMine-Keymap.xml
Created July 8, 2016 09:54
RubyMine-Keymap.xml
<keymap version="1" name="Mac OS X 10.5+ copy" parent="Mac OS X 10.5+">
<action id="Back">
<keyboard-shortcut first-keystroke="meta open_bracket" />
<mouse-shortcut keystroke="button4" />
</action>
<action id="Console.TableResult.NavigateAction">
<keyboard-shortcut first-keystroke="f4" />
</action>
<action id="DomCollectionControl.Edit">
<keyboard-shortcut first-keystroke="f4" />
@tadyjp
tadyjp / text.md
Last active January 28, 2019 03:55
たった2行のコーディングで、お問い合わせフォームを設置できるサービスを作った

はじめに

formrun (フォームラン)という「急なフォームの設置を依頼されたときに短時間で導入できるお問い合わせフォーム」を作ったので,具体的な利用例のコードを紹介したいと思います。

https://form.run/

対象の読者

  • フォーム設置にストレスを感じたことのあるエンジニア・デザイナー
git rev-list --right-only origin/develop...origin/master | xargs git show -q | grep -A 2 'Merge pull request' | perl -pe 's/^\-+//; s/\s+Merge pull request/\- [ ]/;'
@tadyjp
tadyjp / deploy.rb
Created February 2, 2016 01:11
unicorn force restart sequentially (reload /etc/enviroment)
namespace :unicorn do
desc 'Force restart Unicorn (sequential)'
task :force_restart do
on roles(fetch(:unicorn_roles)), in: :sequence, wait: 10 do
within current_path do
if test("[ -e #{fetch(:unicorn_pid)} ]")
if test("kill -0 #{pid}")
info 'stopping unicorn...'
execute :kill, '-s QUIT', pid
else
@tadyjp
tadyjp / Chrome config
Created January 28, 2016 05:08
Google Chromeの検索結果をデフォルト1年にする検索URL
https://www.google.com/search?tbs=qdr:y&q=%s
@tadyjp
tadyjp / calculate-pg-table-size.sql
Last active January 28, 2016 02:49
PostgreSQLでテーブルのレコード数とテーブルサイズを計算する
SELECT a.table_name, pg_relation_size(a.table_name) AS size, b.count FROM information_schema.tables AS a
INNER JOIN (
SELECT relname, n_tup_ins - n_tup_del as count FROM pg_stat_all_tables
) AS b
ON b.relname = a.table_name
WHERE a.table_schema = 'public'
ORDER BY size DESC;