Skip to content

Instantly share code, notes, and snippets.

🍋
Create node.js app for developer

Yoshiyuki Hisamatsu hisasann

🍋
Create node.js app for developer
Block or report user

Report or block hisasann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hisasann
hisasann / .gvimrc
Created Jun 2, 2019
the setting font part of .gvimrc
View .gvimrc
if has('gui_macvim')
set transparency=10
set guifont=Ricty\ Regular\ for\ Powerline:h13
set guioptions-=T
endif
@hisasann
hisasann / .vimrc
Last active Jun 2, 2019
the airline part of .vimrc
View .vimrc
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
@hisasann
hisasann / sha1.js
Created Feb 16, 2019
ファイルから sha1 のハッシュ値を計算するコード
View sha1.js
'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'));
@hisasann
hisasann / rgb2hsv.ts
Created Oct 24, 2018
RGBからHSVに変換するTypeScript
View rgb2hsv.ts
// 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;
View color-thief.js
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);
View node-canvas.js
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);
@hisasann
hisasann / buildspec.yml
Created Oct 21, 2018
AWS ECR に CodeBuild から push までするときの buildspec.yml
View buildspec.yml
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:
View aws-ecs-stack.md

Stack

  • TypeScript: AltJS

    • webpack: Serverless Framework の TypeScript テンプレートで使用

    • node-canvas: 画像ジェネレーターの中核を担うサーバーサイド canvas

    • Jest: テストは Jest のみを使用

View camera起動forElectron.js
window.addEventListener('load', function(){
navigator.mediaDevices.getUserMedia({audio: false, video: true}).then((stream) => {
const video = document.createElement('video');
video.id = 'drag';
video.draggable=true;
document.body.appendChild(video);
video.src=window.URL.createObjectURL(stream);
video.style='position: absolute; left: 10px; top: 10px; max-width: 300px; max-height: 300px; border: 1vmin solid white; z-index:99999;';
video.play();
View 文字の幅確認.md

文字の幅確認

iOS

全角 - 6文字(湖湖湖湖湖湖) 半角英字 - 10文字(AAAAAAAAAA) 半角カタカナ - 12文字(ママママママママママママ)

Android

You can’t perform that action at this time.