Skip to content

Instantly share code, notes, and snippets.

Luu Tuan Anh rockkhuya

Block or report user

Report or block rockkhuya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9044740
Javascript
function update_versions_div(project_id) {
jQuery.ajax({
url: "/update_versions",
type: "GET",
data: {"project_id" : project_id},
dataType: "html"
success: function(data) {
jQuery("#versionsDiv").html(data);
@rockkhuya
rockkhuya / controller.rb
Last active Aug 29, 2015
use cocoon to create nested
View controller.rb
accepts_nested_attributes_for :tour_irregular_schedules,
allow_destroy: true, reject_if: proc { |a| a["start_date"].blank? && a['all_season_flg'].blank? }
@rockkhuya
rockkhuya / js
Created Feb 5, 2014
Use Jquery to add dynamic field and edit value before submit
View js
$(function(){
$("a[shp-action=add_field_need_things]").click( function(){
var num = $("ul[shp-role=dynamic_field_need_things]").length + 1;
var new_element = [];
new_element.push(
'<ul class="inline nested-fields" shp-role="dynamic_field_need_things" id="', num, '">',
'<li>',
'<input class="input-mini" id="', num, '" name="need_things" shp-role="dynamic_field_need_things" type="text" />',
'</li>\n',
'<li><a id="', num, '" shp-role="delete_field_need_things">×</a> </li>',
@rockkhuya
rockkhuya / Write HTML in Javascript
Last active Aug 29, 2015
Use push to write HTML code in Javascript
View Write HTML in Javascript
var new_element = [];
new_element.push(
'<ul class="inline nested-fields" shp-role="dynamic_field_need_things" id="', num, '">',
'<li>',
'<input class="input-mini" id="', num, '" name="need_things" shp-role="dynamic_field_need_things" type="text" />',
'</li>\n',
'<li><a id="', num, '" shp-role="delete_field_need_things">×</a> </li>',
'</ul>'
);
@rockkhuya
rockkhuya / git_flow_lta.zsh-theme
Created Jan 22, 2014
OH-MY-ZSH git-flow theme
View git_flow_lta.zsh-theme
# Created by Luu Tuan Anh, OKWave Inc.
function git_prompt_info_short() {
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
ref="${ref#refs/heads/}"
if echo "$ref" | egrep "feature" > /dev/null; then
ref="f/${ref#feature/}"
fi
if echo "$ref" | egrep "release" > /dev/null; then
You can’t perform that action at this time.