Skip to content

Instantly share code, notes, and snippets.

@YutaroSoejima
YutaroSoejima / app.js
Created October 22, 2016 08:19
Node.js v7 で async/awaitを試してみる ref: http://qiita.com/yutarosoejima/items/4155c59055e86bdf7a96
const wait = (delay) => {
return new Promise(resolve => setTimeout(resolve, delay));
}
async function tryWaitFunction () {
console.log('スタート')
await wait(1000);
console.log('途中')
await wait(1000);
console.log('終わり')
@YutaroSoejima
YutaroSoejima / file0.js
Last active October 22, 2016 07:59
Node.js(ES6)でみるObserverパターン ref: http://qiita.com/yutarosoejima/items/a8caa505225e137b34ca
// クラスの定義
class User {
constructor(name, email) {
this.name = name;
this.email = email;
}
save() {
console.log('DBにユーザー情報を保存してPromiseを返す、ていで。');
/* 画像ファイルの指定 */
background-image: url(images/background-photo.jpg);
/* 画像を常に天地左右の中央に配置 */
background-position: center center;
/* 画像をタイル状に繰り返し表示しない */
background-repeat: no-repeat;
/* コンテンツの高さが画像の高さより大きい時、動かないように固定 */