Skip to content

Instantly share code, notes, and snippets.

View s4na's full-sized avatar
🐧
💨💨💨

Satoshi Nabetani s4na

🐧
💨💨💨
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@rummelonp
rummelonp / faraday.md
Last active May 20, 2022 12:23
Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた

[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた

@tatzyr
tatzyr / image.md
Last active July 5, 2023 12:19
Markdownで画像を表示する

Markdownで画像を表示する

Markdownでは文書中に画像ファイルを表示することができる。GitHubでReadmeに使うと見栄えがいい。

エビフライトライアングル

Markdown記法で書くならこんな感じ。"サンプル"の部分は省略可能。

![エビフライトライアングル](http://i.imgur.com/Jjwsc.jpg "サンプル")
@speedmax
speedmax / ssl_requirement_spec.rb
Created July 9, 2013 06:22
How to test rack middleware
require 'spec_helper'
# Based on https://github.com/rails/ssl_requirement/blob/master/lib/ssl_requirement.rb
class SslRequirement
def initialize(app, options= {})
@app = app
@allowed = options[:allowed]
@required = options[:required]
end
@edokeh
edokeh / index.js
Last active June 11, 2024 01:31
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@bluerabbit
bluerabbit / gist:9064116
Created February 18, 2014 03:20
空コミットでpull requestを作る
git checkout -b topic_branch
git commit --allow-empty -m 'Make a pull request'
git push --set-upstream origin topic_branch
hub pull-request -b develop
hub browse -- pull/{pull_request_id}
@JunichiIto
JunichiIto / alias_matchers.md
Last active June 16, 2024 23:01
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@mlanett
mlanett / rails http status codes
Last active June 14, 2024 06:07
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do

マージ済みのリモートブランチを全て削除

git branch -r --merged master | grep -v -e master -e develop | sed -e 's% *origin/%%' | xargs -I% git push --delete origin %
  1. remote の master に merge済み の branch をすべて表示して
  2. master と develop は消えてほしくないので除外して
  3. origin/ を削除して
  4. xargs (-I% % で ブランチ名を渡しつつ、全て削除する)