Skip to content

Instantly share code, notes, and snippets.

@tkd55
tkd55 / tips.md
Last active November 6, 2019 10:40
tips

オブジェクトの配列で重複した要素を削除する

const distinctArray = array => {
  const cleanList = array.filter((value1, index, array) => {
    // findIndex : 同じ要素があればそのインデックスを返す
    // nameの値が同じもののインデックスと全体のインデックスが同じものだけ抽出
    return array.findIndex(value2 => value1.name === value2.name) === index;
  });

  return cleanList;
@tkd55
tkd55 / ffmpeg_for_ec2.md
Last active June 28, 2017 07:01
ffmepg install for AWS EC2

yumライブラリをインストール

$ sudo yum -y install autoconf automake make gcc gcc-c++ pkgconfig wget libtool zlib-devel
$ sudo yum -y install git

libmp3lameのインストール

$ cd /usr/local/src
$ sudo yum install -y nasm yasm
@tkd55
tkd55 / lectureGit.md
Last active March 31, 2016 02:50
Git勉強会

Git勉強会

概念

git の4つの状態

  1. 作業ツリー ローカルレポジトリ上にある現在の作業ファイル 作業ツリーの変更点はaddによりインデックスに追加

  2. インデックス(ワーキングツリー)

@tkd55
tkd55 / nodejs_env.md
Created June 19, 2015 05:44
node.js環境設定

nodebrew編

nodebrewのインストール

$ curl -L git.io/nodebrew | perl - setup

.bash_profile に以下を追記

@tkd55
tkd55 / MVVM_JS.md
Created February 18, 2015 05:58
JavaScript Design Pattern MVVM
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <div id="first-view">
        <h2>First View</h2>
@tkd55
tkd55 / vibrate_JS.md
Created February 18, 2015 05:43
vibrate for JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <button id="vibration-btn">vibration</button>
@tkd55
tkd55 / JavaScript_ES6.md
Created February 18, 2015 05:18
JavaScript ES6

ES5

/*
function Animal(name){
    this.name = name;
}

Animal.prototype.cry = function(voice){
 console.log(voice + 'と鳴きました');
@tkd55
tkd55 / devicemotion_JS.md
Created February 18, 2015 05:16
deviceorientation and devicemotion for JavaScript
<!DOCTYPE html>
<html lang="jp">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    
    <div>
@tkd55
tkd55 / gist:42b06a0bfab81c555ccc
Last active January 10, 2017 02:10
usage of vi editor

vi エディタの使い方

エディタの起動

$ vi ファイル名

エディタの状態

viエディタには3つの状態が存在しますが、ここではよく使う2つの状態「コマンドモード」と「編集モード」について説明します。

@tkd55
tkd55 / express4.x.md
Last active August 23, 2020 11:38
express 4.x系でBasic認証

express4.x系

4.x系からは「basic-auth-connect」をインストール

$ npm install basic-auth-connect

全体にBasic認証

var basicAuth = require('basic-auth-connect');
app.use(basicAuth('username', 'password'));