Skip to content

Instantly share code, notes, and snippets.

View channainfo's full-sized avatar
🎯
Focusing

Channa Ly channainfo

🎯
Focusing
  • InSTEDD, SureSwift Capital, BookMeBus, VTENH, Onthegosystems
  • Phnom Penh
  • X @channaly
  • LinkedIn in/channaly
View GitHub Profile
@channainfo
channainfo / config.yml
Created December 15, 2019 06:28
CircleCI rubyonrails 4.2, Yarn, React, Ruby 2.3, MySQL
version: 2 # use CircleCI 2.0
jobs: # a collection of steps
build: # runs not using Workflows must have a `build` job as entry point
parallelism: 1 # run three instances of this job in parallel
docker: # run the steps with Docker
- image: circleci/ruby:2.3.4-jessie-node # ...with this image as the primary container; this is where all `steps` will run
environment: # environment variables for primary container
BUNDLE_JOBS: 3
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
@channainfo
channainfo / docker-compose.yml
Last active January 2, 2020 03:15
docker compose for rails app
version: '3'
services:
memcached:
image: memcached:1.5-alpine
volumes:
- memcache:/data
db:
image: mysql:5.7
@channainfo
channainfo / Dockerfile
Created September 18, 2019 05:42
Rails + Yarn + Nodejs for rubyonrails with reactonrails.
FROM ruby:2.3
LABEL maintainer="Channa <[email protected]>"
# Updating nodejs version
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# Install dependencies
@channainfo
channainfo / application.yml
Last active September 17, 2019 09:57
docker-application.yml
default: &default
DATABASE_NAME_DEVELOPMENT: 'avocado_docker_dev'
DATABASE_USER: 'root'
DATABASE_PASSWORD: ''
DATABASE_POOL_SIZE: '50'
DATABASE_HOST: 'db' # container from docker
MEMCACHED_SERVER: 'memcached:11211' #container name
development:
@channainfo
channainfo / docker-compose file-rails-4.2.1
Last active September 17, 2019 06:14
docker-compose rails-4.2.1 sidekiq mysql
version: '3'
services:
db:
image: mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- db:/var/lib/mysql
@channainfo
channainfo / Dockerfile-rails-4.2.1
Last active September 17, 2019 06:15
Docker file for rails 4.2.1 with reactrails and yarn
FROM ruby:2.3
LABEL maintainer="Channa <[email protected]>"
# Updating nodejs version
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
# Install dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
@channainfo
channainfo / aws_parameter_store_eb_extension.bash
Last active July 8, 2019 11:31
bash script to read aws parameter store to update elastic beanstalk env variable
#!/usr/bin/env bash
## to update the main process with >> . file_name
##function definition
process_json(){
#$1: json string
#$2: indicee
#$3: env name
json=$1
i=$2
@channainfo
channainfo / Gemfile
Last active July 4, 2020 02:02
Calculate closest point on the road to an address in ruby on rails
# sudo apt get install libgeos-dev
# sudo apt-get install proj-bin
gem 'rgeo' # required http://trac.osgeo.org/geos
gem 'ffi-geos'
@channainfo
channainfo / webpack.config.js
Created May 4, 2019 17:03
Multiple entries from a directory dynamically
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const templateEntries = glob.sync('./js/templates/**.js').reduce(function(obj, el){
var name = "./templates/" + path.parse(el).name
obj[name] = el;
@channainfo
channainfo / webpack.config.js
Last active May 2, 2019 01:52
multiple entries js, css in phoenix framework webpack
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (env, options) => ({
optimization: {
minimizer: [