Skip to content

Instantly share code, notes, and snippets.

View hoasung01's full-sized avatar
🎯
Focusing

Nguyen Ngoc Hai hoasung01

🎯
Focusing
View GitHub Profile
@hoasung01
hoasung01 / tai-keynote-free.rb
Created November 24, 2015 00:16
tai keynote free
http://www.cultofmac.com/306118/download-apples-iwork-apps-older-macs-free/
@hoasung01
hoasung01 / fix_serializer_with_lightweight.rb
Created November 23, 2015 06:35
fix_serializer_with_lightweight.rb
class PodSerializer < ActiveModel::Serializer
attributes :pod_type, :pod_picture
def pod_picture
@object.picture.present? ? @object.picture.url : nil
end
end
class ShippingListSerializer < ActiveModel::Serializer
@hoasung01
hoasung01 / link_to_awesome-slim
Created November 23, 2015 04:35
link_to awesome icon with slim
@hoasung01
hoasung01 / undo-a-git-merge.git
Created November 12, 2015 02:51
undo a git merge
git reset --merge ORIG_HEAD
@hoasung01
hoasung01 / xu-ly-nhieu-su-kien-tren-cung-mot-phan-tu.js
Created November 9, 2015 14:17
[javascript] xu ly nhieu su kien tren cung mot phan tu
$ ( "# my-id" ) .bind ({
click: function () {
/ / code ở đây
},
mouseup: function () {
/ / code ở đây
}
});
Code trên xử lý 2 sự kiện mouseup và click cùng trong một ràng buộc.
@hoasung01
hoasung01 / toi-uu-code-trong-cach-viet-decorator.rb
Created November 9, 2015 10:32
toi uu code trong cach viet decorator
def decorate_process
((object.amount_funded/object.amount)*100).to_s + "%" # SHOULD NOT
"#{object.amount_funded/object.amount*100}%" # SHOULD
end
@hoasung01
hoasung01 / using-multiple-heroku-account.rb
Created November 9, 2015 05:20
using multiple heroku account in same machine
1. install this plugins https://github.com/ddollar/heroku-accounts
2. need to change something to make this plugin work well
cd ~/.heroku/plugins/heroku-accounts
git remote rm origin
git remote add origin https://github.com/heroku/heroku-accounts.git
git fetch
git merge origin/master
@hoasung01
hoasung01 / js-preventDefault.js
Created November 9, 2015 04:04
su kien preventDefault
// e.preventDefault();
ngan chan su kien mac dinh. Vi du khi click form thi e.preventDefault no se ko submit nua
@hoasung01
hoasung01 / error-style-devise.rb
Created November 9, 2015 02:40
error style devise
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
@hoasung01
hoasung01 / standard-structure-for-html.html.slim
Last active November 5, 2015 02:30
standard structure for html and css in rails app
1. /views/layouts/appliation.html.slim
head
boby
#container
header
= render 'shared/menu'
= render 'shard/banner'
main
= yield