Skip to content

Instantly share code, notes, and snippets.

View leonguyen's full-sized avatar

Nam Nguyen leonguyen

View GitHub Profile
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
var params = {};
params.a = '123';
async.parallel([
//Step 1
function(cb){
//Code here
cb(null);
},//Step 2
function(cb){
//Code here
cb(null);
},
@leonguyen
leonguyen / gist:47eb72f2f914f2746a28
Created June 11, 2014 06:33
'$' was used before it was defined
//Bad
var contain = $('#container');
//Good
var $contain = $('#container');
@leonguyen
leonguyen / gist:7ab9eb103026ca55c3d3
Last active August 29, 2015 14:02
Missing 'use strict' statement
(function() {
"use strict";
//Code here
}());
(function($){
//Code here
})(jQuery);
$.ajax({
url: '/control/param',
dataType: 'json',
data: {
'id': id
},
type: 'POST',
success: function(res) {
if (res.success) {
success_msg(res.msg)
$('#frm').submit(function(e){
e.preventDefault();
return false;
});
$(document).on('submit', '#frm', function(e) {
e.preventDefault();
var data = $(this).serialize();
update(data);
});
var open = [];
if(req.session.OPEN){
open = JSON.parse(req.session.OPEN);
}//if OPEN
open.push(tid); console.log('[_COpenedTopAdd] OPEN:' + open);
req.session.OPEN = JSON.stringify(open);
@leonguyen
leonguyen / gist:5b15e88a54552c83d74a
Last active August 29, 2015 14:02
Cookie Guest
//Guest
if (UID ==-1 && req.cookies.TAG){
var tag = [];
tag = JSON.parse(req.cookies.TAG); console.log('[]' + tag);
var idx = _.indexOf(tag, TID);
if(idx != -1){
tag.splice(idx, 1);
console.log('[] Cookie TAG TID:' + TID);
}//if idx
}//if Guest cookies.TAG