Skip to content

Instantly share code, notes, and snippets.

View duykhoa's full-sized avatar

Kevin Tran duykhoa

View GitHub Profile
@duykhoa
duykhoa / GJviA.markdown
Created July 24, 2014 09:44
A Pen by duykhoa.
@duykhoa
duykhoa / paperclip_storage_option.rb
Last active August 29, 2015 14:15
Custom paperclip storage in model
module PaperclipStorageOption
module ClassMethods
def options
Rails.env.production? ? production_options : default_options
end
private
def production_options
{
@duykhoa
duykhoa / gist:2ce3b538185118dc9d1a
Last active August 29, 2015 14:16
wufoo contact form
* {
font-family: "Lato", Arial;
}
header#header {
display: none;
}
input {
color: #676767;
font-size: 11px;
@duykhoa
duykhoa / kaminari-question.md
Last active August 29, 2015 14:17
Kaminari basic

Kaminari (Coding)

###A. Support part

####1. extend, include.

Ex1:

module A

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file:

@duykhoa
duykhoa / model_convention.md
Created April 19, 2015 04:23
rails model conventions

Base on rails guide

  1. module include, extend
  2. scope (default first, then other scopes)
  3. constant
  4. attr
  5. association
  6. validate
  7. callback
  8. method
@duykhoa
duykhoa / hero.rb
Last active August 29, 2015 14:19
class Traxex < Hero::RangedAgilityHero
# many things above
# ....
def normal_attack
arrow_shoot(base_damage)
end
def frost_arrows_attack
@is_iced_stun_affected = true
class Traxex
# st above
def attack
# do st
end
end
class AttackDecorator
def initialize(hero_object)
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
@duykhoa
duykhoa / deploy.rb
Last active August 29, 2015 14:22 — forked from jbonney/deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
# Usually mina focuses on deploying to one host and the deploy options are therefore simple.
# In our case, there is a number of possible servers to deploy to, it is therefore necessary to
# specify the host that we are targeting.
server = ENV['server']
# Since the same host can have multiple applications running in parallel, it is necessary to