Skip to content

Instantly share code, notes, and snippets.

View truonglocbinh's full-sized avatar

truong.loc.binh truonglocbinh

View GitHub Profile
#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
@truonglocbinh
truonglocbinh / gist:db4ff8309eb892739ce2514b085a526d
Created January 4, 2022 01:10
How to deploy manually rails app without capistrano
https://gorails.com/deploy/ubuntu/20.04
https://gorails.com/setup/osx/11-big-sur
After clone repo just install ruby, nodejs and database
bundle exec rails webpacker:install
rails assets:precompile RAILS_ENV=production
RAILS_ENV=production rails db:migrate
https://chienkira.github.io/blog/posts/h%C6%B0%E1%BB%9Bng-d%E1%BA%ABn-c%C3%A0i-%C4%91%E1%BA%B7t-server-rails-puma-nginx/
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04
@truonglocbinh
truonglocbinh / gist:29d059b23dfd4a6a69186fe3450abb2c
Created January 25, 2018 08:11 — forked from lsauer/gist:1305056
Easiest way to find duplicate values in a JavaScript array - Native unique function implementation
//lo sauer, 2011; lsauer.com
/**
* I saw this thread: http://stackoverflow.com/questions/840781/easiest-way-to-find-duplicate-values-in-a-javascript-array
* The solutions above lacked the elegance that can be done a with map-reduce-like operations
* Since this implementation works with native functions, the speed is in most circumstances faster
* than any solution using scripted-logic
* Additionally, I needed to quickly filter duplicate url-entries for: http://lsauer.github.com/chrome-session-restore/
*/
//copy and paste: without error handling
Array.prototype.unique = function(){return this.sort().filter( function(v,i,o){if(i>=0 && v!==o[i-1]) return v;});}
@truonglocbinh
truonglocbinh / hello.coffee
Created November 18, 2015 00:33
coffee scripts can not run in rails
$ ->
$("a[data-background-color]").click(e) ->
e.preventDefault()
backgroundColor = $(this).data("background-color")
textColor = $(this).data("text-color")
paintIt(this, backgroundColor, textColor)