Entries from 2017-04-01 to 1 month

マルチバイト文字, fromCharCode, charCodeAt, Unicode

マルチバイト文字かどうか確認 /** * UTF-8における、1Byte以外の文字かどうか * -> 0-127 (ASCII 文字セット) 以外 */ function hasMultibyte(str) { return /[^\u0000-\u007f]/.test(str); } hasMultibyte('a'); // -> false hasMultibyte('>'); // -> fal…

(WIP) Cloud Node.js Clientを利用してBigQueryのクエリ結果を取得

0. 動機 BigQueryの実行結果を整形・表示・チャート化しやすい環境をつくる ほぼ自分用 1. Nodeからクエリを実行 GitHub - GoogleCloudPlatform/google-cloud-node: Google Cloud Client Library for Node.js 準備 npm install --save @google-cloud/bigquer…

TypeScriptでJSONファイルをimportする

webpack2利用時。 custom-typings.d.ts declare module '*.json' { const value: any; export default value; } foo.ts import * as data from './data.json'; // ... Support shorthand ambient module declarations and wildcard chars in module names · …

通貨記号つきで金額を表示

便利。(最近まで知らなかった) IEは11以上なら大丈夫。 console.log(number.toLocaleString('ja-JP', { style: 'currency', currency: 'JPY' })) // → ¥123,457 console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).for…

ng-tableさわる

http://ng-table.com/ 準備 webpack×TypeScriptの場合 webpack.config.js module.exports = { // ... module: { rules: [ { test: /\.tsx?$/, loader: 'ts-loader' }, { test: /\.html$/, use: [ { loader: 'ngtemplate-loader', options: { requireAngular:…

three.jsさわる

The Making of "The Aviator": Animating a Basic 3D Scene with Three.js | Codrops ここのチュートリアルが分かり易い&サンプルがかわいい。