This file contains hidden or 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
package main | |
// 設定情報を格納する ← メッセージ出しやがる | |
type Config struct {} | |
// ConfigError は設定情報に不備があった場合のエラー情報を格納する ← 推奨しているらしい | |
type ConfigError struct {} | |
// Fooを返す ← メッセージ出しやがる | |
func GetFoo() string { |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
s := "日本語" | |
fmt.Println(string(s[0])) // => æ | |
fmt.Println(string(getRuneAt(s, 0))) // => 日 |
This file contains hidden or 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
git --version | |
# git version 2.0.0 | |
cd /opt/src | |
wget https://www.kernel.org/pub/software/scm/git/git-2.8.1.tar.gz | |
tar xf git-2.8.1.tar.gz | |
cd git-2.8.1 | |
./configure --prefix=/opt/git/git-2.8.1 --with-openssl --with-curl | |
make | |
make install | |
/opt/git/git-2.8.1/bin/git --version |
This file contains hidden or 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
(function() { | |
'use strict'; | |
angular.module('app').directive('fixedOnTop', function($window) { | |
return { | |
restrict: 'A', | |
link: function($scope, element, attrs) { | |
angular.element($window).on('scroll', function() { | |
var baseTop = element.get(0).offsetTop; | |
if (angular.element(this).scrollTop() >= baseTop) { |
This file contains hidden or 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
# parallels のログ削除 | |
$ sudo rm /Library/Logs/parallels.* | |
# homebrew の不要ファイル削除 | |
$ brew cleanup | |
# キャッシュの削除 | |
$ sudo rm -dfR /System/Library/Caches/* /Library/Caches/* ~/Library/Caches/* |
This file contains hidden or 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
FactoryGirl.define do | |
factory :user do | |
email '[email protected]' | |
password 'newSecurePassw0rd' | |
confirmation_token 'xxxxxxxxxxxxxxxx' | |
confirmation_sent_at '2016-02-02 12:34:56.1234567' | |
end | |
end |
This file contains hidden or 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
require 'test_helper' | |
class ConfirmationsControllerTest < ActionController::TestCase | |
setup do | |
@request.env['devise.mapping'] = Devise.mappings[:user] | |
end | |
test '登録して10日以内なら確認可' do | |
user = create(:user).reload |
This file contains hidden or 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
module Devise | |
module Models | |
module Confirmable | |
# some code | |
protected | |
# some code |
This file contains hidden or 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
require 'test_helper' | |
class ConfirmationsControllerTest < ActionController::TestCase | |
setup do | |
@request.env['devise.mapping'] = Devise.mappings[:user] | |
end | |
test '登録して10日以内なら確認可' do | |
user = create(:user) |
This file contains hidden or 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
Devise.setup do |config| | |
# 複数モデルを可能にする | |
config.scoped_views = true | |
# スコープごとのサインアウトを可能にする | |
# デフォルトの状態ではコメントアウトされているので、コメントアウトを外して false を設定する | |
config.sign_out_all_scopes = false | |
end |