プログラムが複雑になる一番の理由は条件分岐 (if 文など) です。
条件分岐がなければ、一本道で読み下していけばいいのでバグが入り込む余地は大変少なくなります。
ということで、
- 条件分岐を書かなくていいように書く
- 条件分岐を書くなら、わかりやすく局所化して書く
AWSTemplateFormatVersion: "2010-09-09" | |
Description: > | |
Launch a static website backed by an S3 bucket and served via https through cloudfront. | |
Assumes you have the following available already | |
* An address in mind (e.g. blog.example.com) | |
* An existing Route53 Hosted Zone for the domain | |
* A validated AWS ACM certificate arn for the desired web address which must be in eu-west-1 | |
Parameters: | |
HostedZoneID: | |
Description: > |
{ | |
"presets": [ | |
[ | |
"env", | |
{ | |
"modules": false, | |
"targets": { | |
"browsers": "> 1%", | |
"uglify": true | |
}, |
/** | |
* Axios Request Wrapper | |
* --------------------- | |
* | |
* @author Sheharyar Naseer (@sheharyarn) | |
* @license MIT | |
* | |
*/ | |
import axios from 'axios' |
#!/bin/sh | |
## EC2 automation login tool | |
# | |
# Original: http://m.igrs.jp/blog/2013/03/14/ec2-ssh/ | |
# https://gist.github.com/migrs/5157665 | |
# https://gist.github.com/MichinobuMaeda/5545875 | |
# | |
# Changed by mo-ya (2013-07-06) | |
# |
# vim: ft=yaml | |
# Elastic Load Balancer and Security Group configuration for the app | |
# | |
# - Allow anyone to connect to port 443 and office traffic to connect to | |
# port 22 | |
# - Ensure all traffic is encrypted by configuring load balancer to listen on | |
# 443 and direct traffic to port 443 on app servers | |
# - Enable cookie-based session stickiness | |
# - Use /status for health check | |
# - Enable backend authentication policy by providing public key for cert |
基礎知識
読み物系
console.log("got here"); | |
var page = require('webpage').create(); | |
page.onConsoleMessage = function(msg) { | |
console.log(msg); | |
}; | |
page.open("http://facebook.com", function(status) { | |
if ( status === "success" ) { |