Skip to content

Instantly share code, notes, and snippets.

View jackyvo's full-sized avatar

Jacky Vo jackyvo

View GitHub Profile
t = 236 # seconds
Time.at(t).utc.strftime("%H:%M:%S")
=> "00:03:56"
# Reference
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time
@jackyvo
jackyvo / dnsmasq_setup_osx.md
Created May 4, 2018 04:35 — forked from eloypnd/dnsmasq_setup_osx.md
wildcard DNS record on OS X in localhost development with dnsmasq

wildcard DNS in localhost development

$ brew install dnsmasq
   ...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
  • edit /usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1
@jackyvo
jackyvo / generate_leads.sh
Created December 15, 2015 04:44 — forked from aantix/generate_leads.sh
Rails : script/runner with rvm called from cron
#!/usr/bin/env bash
source /usr/local/rvm/environments/ruby-1.9.2-p318@action_traction
cd /var/www/action_traction/current
script/rails runner -e production "LeadSearch.generate_leads" 2>&1 >> /var/www/action_traction/current/log/generate_leads.log
# Job model
class Job < ActiveRecord::Base
# Constants ##
# ==> Need to move all and group in one place such as constants.rb to easy to update
FEATURE_JOB_DAYS = 7
STATUS = {offline: false, online: true}
JOBS_PER_PAGE = 20
# Refactor scopes and split to small scope ##
# live scope need to be seperated into 2 scopes with special functionality
@jackyvo
jackyvo / es.sh
Last active August 29, 2015 14:18 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
# install missing libraries (if any)
cd ~
sudo yum update
yum install java-1.7.0-openjdk.x86_64
yum install unzip
yum install mc
yum install wget
yum install curl
# get and unpack elasticsearch zip file

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
Total entries for git version control
Source: http://www.gitguys.com/