Skip to content

Instantly share code, notes, and snippets.

View kevin-shu's full-sized avatar

Kevin Shu kevin-shu

  • Apple Buds, Inc.
  • Taiwan
View GitHub Profile
@kevin-shu
kevin-shu / currying
Last active December 16, 2015 21:38
function currying(fn) {
var store_args = Array.prototype.slice.call(arguments,1);
return function () {
args = store_args.concat(Array.prototype.slice.call(arguments));
return fn.apply(null, args);
};
}
function formToData(dom) {
var _this=this,
_i,
data;
if(dom){
_this=dom;
}
fields = _this.querySelectorAll("input, textarea, select");
for(_i=fields.length-1; i>=0; _i--){
var _key = fields[_i].name||fields[_i].id;
INSERT INTO SYS_SKILLS
(name, sys_category_id)
value
(x,y),
(x,y),
(x,y),
(x,y),
(x,y),
(x,y)
....
# In Helper
module MetaHelper
def meta_tag type
if type==1
return "<meta name='keywords' content='HTML,CSS,XML,JavaScript'>"
elsif type==2
return "<meta name='keywords' content='HTML,CSS,XML,JavaScript'>"
else
return "<meta name='keywords' content='HTML,CSS,XML,JavaScript'>"
end
function ranking(elem, index) {
if (index>=0 && index<5113) {
elem._src.rank = 1;
} else if (index>=5113 && index<10226) {
elem._src.rank = 2;
} else if (index>=10226 && index<25566) {
elem._src.rank = 3;
} else {
elem._src.rank = 4;
}