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
const aws = require('aws-sdk'); | |
aws.config.region = 'ap-northeast-1'; | |
const s3 = new aws.S3(); | |
console.log('Loading function'); | |
exports.handler = async (event, context) => { | |
var params = { | |
Bucket: 'sample', | |
Key: 'sample.json', |
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
$ docker run -t -v ${PWD}:/work embulk guess ./try1/seed.yml -o config.yml # Running example を実行 | |
2018-11-15 11:11:11.591 +0000: Embulk v0.9.9 | |
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException | |
at org.apache.bval.jsr303.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:268) | |
at org.apache.bval.jsr303.ConfigurationImpl.prepare(ConfigurationImpl.java:258) | |
at org.apache.bval.jsr303.ConfigurationImpl.doPrivBuildValidatorFactory(ConfigurationImpl.java:248) | |
at org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:131) | |
at org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:129) | |
at org.apache.bval.jsr303.ConfigurationImpl.run(ConfigurationImpl.java:337) | |
at org.apache.bval.jsr303.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:244) |
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
class Animal | |
{ cat: 'にゃー', dog: 'わん' }.each do |name, message| | |
# 動的にクラスやモジュールを定義でき、defによるメソッド定義をしなくてもよい | |
# メソッド本体はブロックで記述する | |
define_method(name) do | |
message | |
end | |
end | |
end |
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
module ViewString | |
def view(message) | |
puts message | |
end | |
end | |
class Sample1 | |
# includeした場合、インスタンスメソッドとして使える | |
include ViewString | |
end |
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
# ダブルクォート | |
# ・バックスラッシュ記法と式展開が有効になる | |
str1 = "式展開も試してみます" | |
puts "ダブルクォートのサンプル文字列です\n\nそして、#{str1}" | |
# 文字列内でダブルクォートを使いたい場合、エスケープ文字を入れる | |
# ※「サンプル文字」をダブルクォートで括ってみる | |
puts "ダブルクォートの\"サンプル文字列\"です\n\nそして、#{str1}" | |
# シングルクォート |
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 display_message(name:, message:) | |
p "#{name} : #{message}" | |
end | |
display_message(name: 'John', message: 'Hello') | |
display_message(message: 'Hello', name: 'John') | |
display_message | |
display_message('John', 'Hello') |
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 display_message(name: 'Smith', message: 'Sample') | |
p "#{name} : #{message}" | |
end | |
display_message | |
display_message(name: 'John', message: 'Hello') | |
display_message(message: 'Hello', name: 'John') | |
display_message('John', 'Hello') |
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 display_messages(name, message_first, message_second) | |
p "#{name} : #{message_first}" | |
p "#{name} : #{message_second}" | |
end | |
# 実行(正常動作) | |
messages = %w(Hello Goodbye) | |
display_messages 'John', *messages |
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 display_messages(name, *messages) | |
messages.each do |message| | |
p "#{name} : #{message}" | |
end | |
end | |
# 実行 | |
display_messages 'John', 'Hello', 'Goodbye', 'Thank you' |
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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder