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
import EventEmitter from 'eventemitter3'; | |
class PromiseEmitter extends EventEmitter { | |
emit(event, ...args) { | |
let promises = []; | |
this.listeners(event).forEach((listener) => { | |
promises.push(listener(...args)); | |
}); |
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
originの状態を確認する | |
git remote show origin | |
pullやpushがどう紐付いているか確認できる | |
ローカルに作ったブランチをリモートに反映 | |
git push origin feature/a | |
リモートから削除されたブランチをローカルにも反映 | |
git fetch -p | |
これも同じみたい(プル?ン) |
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 array = ['foo']; | |
array.hoge = 'hoge'; | |
// あくまでも配列の順番通りに変数が割り振られる | |
// foo という key を抜き取ってきているわけではない | |
const [ foo ] = array; | |
// hoge という key を取ってきている | |
const { hoge } = array; | |
console.log(foo); // foo |
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
if has('gui_macvim') | |
set transparency=10 | |
set guifont=Ricty\ Regular\ for\ Powerline:h13 | |
set guioptions-=T | |
endif |
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
NeoBundle 'vim-airline/vim-airline' | |
NeoBundle 'vim-airline/vim-airline-themes' | |
"--------------------------------------------------------------------------- | |
" for bling/vim-airline {{{ | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
let g:airline_section_a = airline#section#create(['mode','','branch']) | |
let g:airline#extensions#tabline#enabled = 1 |
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 strict' | |
const crypto = require('crypto'); | |
const fs = require('fs'); | |
const shasum = crypto.createHash('sha1'); | |
const app_a = __dirname + '/path/to/file.txt'; | |
fs.readFile(app_a, (err, data) => { | |
shasum.update(data); | |
console.log(app_a, shasum.digest('hex')); |
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
// https://lab.syncer.jp/Web/JavaScript/Snippet/66/ | |
/** | |
* rgb から hsv に変換する | |
* @param {[number]} rgb | |
* @returns {[number]} | |
*/ | |
const rgb2hsv = (rgb: [number, number, number]) => { | |
const r: number = rgb[0] / 255; | |
const g: number = rgb[1] / 255; | |
const b: number = rgb[2] / 255; |
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
var ColorThief = require('color-thief-jimp'); | |
var Jimp = require('jimp'); | |
Jimp.read(imageFilepathOrUrl, (err, sourceImage) => { | |
if (err) { | |
console.error(err); | |
return; | |
} | |
var dominantColor = ColorThief.getColor(sourceImage); |
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 { registerFont, createCanvas, loadImage } = require('canvas'); | |
const fs = require('fs') | |
registerFont('./fonts/sazanami/sazanami-gothic.ttf', {family: 'Sazanami Gothic'}); | |
const canvas = createCanvas(500, 500); | |
const ctx = canvas.getContext('2d'); | |
// Draw cat with lime helmet | |
loadImage('images/lemon-sour.jpg').then((image) => { | |
ctx.drawImage(image, 0, 0, 500, 500); |
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
version: 0.2 | |
env: | |
variables: | |
PJ_NAME: "aws-ecs-sample-app" | |
REPO_NAME: "ここに数字.dkr.ecr.ap-northeast-1.amazonaws.com/aws-ecs-sample-app" | |
phases: | |
install: | |
commands: |