Skip to content

Instantly share code, notes, and snippets.

View hoangmirs's full-sized avatar
🚦
Ruby on Rails

Hoàng Mirs hoangmirs

🚦
Ruby on Rails
  • Nimble
  • Danang, Vietnam
  • 17:25 (UTC +07:00)
View GitHub Profile
@hoangmirs
hoangmirs / example_rake_spec.rb
Created June 30, 2020 07:51
RSpec rake tasks
# frozen_string_literal: true
require 'rake_helper'
describe 'example rake task' do
describe '#run', rake: {
file_name: 'file_name_of_rake_task',
engine: Authentication::Engine
} do
it '' do; end
@hoangmirs
hoangmirs / a.js
Last active November 26, 2018 16:02
Share mutations store plugin
import LS from '@/utilities/LocalStorage';
export default ({ paths }) => (store) => {
let committingMutation = [];
store.subscribe((mutation) => {
committingMutation = LS.get('committingMutation') || [];
const mutationType = mutation.type;
if (committingMutation.indexOf(mutationType) !== -1) return;
if (paths.indexOf(mutationType) !== -1) {
LS.set(mutationType, mutation.payload);
@hoangmirs
hoangmirs / ecosystem.config.js
Created November 22, 2018 15:52
Nuxt ecosystem.config.js
module.exports = {
apps: [
{
name: "API",
script: "yarn",
cwd: "/home/deploy/hoang_app/current",
error_file: "/home/deploy/hoang_app/logs/web.err.log",
out_file: "/home/deploy/hoang_app/logs/web.out.log",
// Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
args: "start",
@hoangmirs
hoangmirs / build.js
Last active November 24, 2018 04:17
Config build multiple environment for vuejs with webpack
// build/build.js
// Replace
process.env.NODE_ENV = 'production'
// with
process.env.NODE_ENV = process.argv[2] || 'production'
// Replace
const spinner = ora('building for production...')
// with
const spinner = ora(`building for ${process.env.NODE_ENV}...`)
@hoangmirs
hoangmirs / nuxt_fe.conf
Last active February 16, 2023 13:11
NGINX config files
# For nuxt or next app with node server running on 8000
server {
listen 80;
server_name 212.83.163.175;
server_name #domain name;
root /home/deploy/app;
access_log /home/deploy/app/logs/nginx_access.log;
error_log /home/deploy/app/logs/nginx_error.log;
try_files $uri $uri/ /index.html;
@hoangmirs
hoangmirs / deploy-pm2.md
Last active March 24, 2024 22:01
Deploy pm2 guide

1. Preparing the server

Install git

sudo apt install git-all

Generate Server's SSH public key

ssh-keygen -t rsa -b 4096 -C "deploy"
cat ~/.ssh/id_rsa.pub