This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
class FileUpload { | |
upload(path,domain) { | |
browser.url(domain); | |
browser.waitForExist('.btn-primary', 10000); | |
browser.chooseFile('#snapshot_file', path); | |
browser.element('#btn-upload').click(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http -> https redirect | |
set $check_redirect ""; | |
set $check_domain ""; | |
if ($http_host ~ xx\.xx$) { | |
set $check_domain "on"; | |
} | |
if ($http_host ~ yy\.yy$) { | |
set $check_domain "on"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_eip" "example" { | |
count = "${var.create_eip}" | |
instance = "${aws_instance.example.id}" | |
} | |
resource "aws_route53_record" "example" { | |
count = "${1 - var.create_eip}" | |
zone_id = "A1B2CDEF3GH4IJ" | |
name = "foo.example.com" | |
type = "A" | |
ttl = 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.wrap { | |
width: 500px; | |
margin: 0 auto; | |
} | |
.btn-holder { | |
text-align: center; | |
margin: 10px 0 10px 0; | |
} | |
#calendar table { | |
border-collapse: collapse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= bootstrap_form_for(@article, layout: :horizontal) do |f| | |
= f.text_field :title, autofocus: true | |
= f.text_area :body_source, rows: 20 | |
.form-group | |
.col-sm-offset-2.col-sm-10 | |
= f.button '下書きを保存', name: 'ope[cmd]', value: 'save', class: 'btn btn-lg btn-default' | |
- if @article.draft? | |
= f.button '公開する', name: 'ope[cmd]', value: 'publish', class: 'btn btn-lg btn-default' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include AASM | |
aasm do | |
state :draft, :initial => true | |
state :published | |
#event :publish, before: ->{ self.published_at = Time.now } do | |
event :publish do | |
transitions :from => :draft, :to => :published |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@article = current_user.articles.build(article_params) | |
if @article.valid? | |
@article.save! | |
case params[:ope][:cmd] | |
when 'publish' | |
@article.publish! | |
puts "hi this is publish zone" | |
flash[:success] = '記事を公開しました。' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/models/user.rb | |
def self.find_for_twitter_oauth(auth, signed_in_resource=nil) | |
user = User.where(:provider => auth.provider, :uid => auth.uid).first | |
unless user | |
user = User.create(user_nickname: auth.info.nickname, | |
provider: auth.provider, | |
uid: auth.uid, | |
email: User.create_unique_email, | |
password: Devise.friendly_token[0,20] | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#echo "export RSPEC_ENABLE=0" >> ~/.bashrc | |
should_run_rspec(){ | |
echo "You Should Run RSPEC Test" | |
sed -i 's/export RSPEC_ENABLE=0/export RSPEC_ENABLE=1/g' ~/.bashrc | |
} | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD)" | |
check_file() { | |
for var in $changed_files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app/controller/articles_controller.rb | |
class ArticlesController < ApplicationController | |
before_action :set_article, only: [:show, :edit, :update, :destroy] | |
def show | |
end | |
def edit |
NewerOlder