Skip to content

Instantly share code, notes, and snippets.

View keidrun's full-sized avatar
💭
I may be slow to respond.

keidrun keidrun

💭
I may be slow to respond.
View GitHub Profile
@keidrun
keidrun / index.js
Created May 10, 2020 23:29
Calculate the text width using jQuery
$(function () {
var $target = $('#target');
var text = $target.text();
text.split('').forEach((str) => {
console.log(str + "'s length is " + textWidth($target, str));
});
});
@keidrun
keidrun / ScrollspyNavLink_example.js
Last active September 8, 2019 07:35
Demo codes for reactstrap-scrollspy
@keidrun
keidrun / docker-compose.mongo.auth.yml
Last active February 26, 2024 05:03
Cheat Sheet about Docker Compose For Database
version: '3'
services:
db:
image: mongo:4.0
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: root
ports:
@keidrun
keidrun / Dockerfile
Created May 18, 2019 08:40
How to add tini to a dockerized NodeJS app
FROM node:12.2-alpine
ENV NODE_ENV=production
RUN apk add --no-cache tini
WORKDIR /node
COPY package.json yarn.lock ./
RUN mkdir app && chown -R node:node .
USER node
@keidrun
keidrun / Dockerfile
Created May 18, 2019 06:29
How to change permission for node user on a dockerized NodeJS app
FROM node:12.2-alpine
ENV NODE_ENV=production
WORKDIR /node
COPY package.json yarn.lock ./
RUN mkdir app && chown -R node:node .
USER node
RUN yarn install && yarn cache clean --force
@keidrun
keidrun / README.md
Created May 11, 2019 23:39
AWS CLI alias settings

Install

$ git clone https://github.com/awslabs/awscli-aliases.git
$ mkdir -p ~/.aws/cli
$ cp awscli-aliases/alias ~/.aws/cli/alias
$ rm awscli-aliases/
$ aws whoami
@keidrun
keidrun / Dockerfile
Created May 5, 2019 04:09
Dockerfile for CentOS and NodeJS
FROM centos:centos7
# copied from https://github.com/nodejs/docker-node/blob/170ed2092d4925971f9cd3ad5dfc416e820f90fd/10/stretch/Dockerfile
# edited a bit and replaced '$ARCH' to 'x64'
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
ENV NODE_VERSION=10.15.3
@keidrun
keidrun / README.md
Last active May 20, 2024 13:42
How to marshal and unmarshal sql.Null types to JSON in golang

Answer

Use custom nullable types instead of original sql.Null types like sql.NullBool, sql.NullFloat64, sql.NullInt64 or sql.NullString.

@keidrun
keidrun / Dockerfile
Last active November 11, 2018 11:49
Building a Jenkins Docker Container installed latest Jenkins and Docker
FROM jenkins
USER root
RUN apt-get update \
&& apt-get install -y \
apt-utils \
apt-transport-https \
ca-certificates \
curl \
@keidrun
keidrun / Dockerfile
Last active November 11, 2018 11:41
Building a latest Jenkins with master/slave on Docker
FROM jenkins
USER root
RUN cd tmp/ \
&& wget https://updates.jenkins-ci.org/latest/jenkins.war \
&& mv ./jenkins.war /usr/share/jenkins/
USER jenkins