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
861603377 |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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
.form-div p.error-pink input[type="text"], | |
.form-div p.error-pink input[type="email"], | |
.form-div p.error-pink input[type="tel"], | |
.form-div p.error-pink input[type="url"] { | |
background: pink !important; | |
} |
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
// 絞り込み検索用カスタマイズ | |
// キーワード検索 | |
$s = $_GET['s']; | |
// チェックボックス(栄養素) | |
$nutrient = $_GET['nutrient']; | |
if($nutrient){ // 通常の検索フォームなど$nutrientのクエリが存在しない時はmetaqueryspに追加しない | |
foreach($nutrient as $val){ | |
$metaquerysp[] = array( | |
'key'=>'nutrient', |
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
func addTapGesture(action: @escaping () -> Void) { | |
let tapGesture = UITapGestureRecognizer { (gr) in | |
print("UITapGestureRecognizer fire") | |
switch gr.state { | |
case .ended: | |
self.backgroundColor = UIColor.clear | |
action() | |
default: | |
return | |
} |
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
▶︎routes | |
get "posts/:id" => "posts#show" | |
これでposts/の次に何をいれてもshowが表示される | |
▶︎これでURLを叩くと・・・ | |
sample.com/posts/1 | |
→この1が :id として認識(取得)される | |
→ハッシュ(Swiftでいう辞書)pramsに{id: 1}が格納される(routesがやってるのか?) | |
→ハッシュの値へのアクセスはdies{:キー名}なので、controller側で params[:id]と書けば、この場合は「1」が取得できる |
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
//ゲームの代理人規約(代理人は以下のメソッドを持たねばならない) | |
protocol GameDelegate: class { | |
func cleanPlayground(_ game: Game) //gameのグランドを清掃するメソッド | |
} | |
//グランド清掃役の代理人として、仕事が早いSpeedCleanerDelegateさんを用意しとく | |
class SpeedCleanerDelegate: GameDelegate { | |
func cleanPlayground(_ game: Game) { |
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
class Game { | |
var score = 0 | |
func start(completion: (Int) -> Void) { // 呼び出し先であるメソッド | |
score = arc4random() % 10 // 0から9までの値をランダムで代入 | |
completion(score) // ここでバックする(呼び出し元に引数scoreを渡して処理を実行してもらう) | |
} | |
} |