This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO SYS_SKILLS | |
(name, sys_category_id) | |
value | |
(x,y), | |
(x,y), | |
(x,y), | |
(x,y), | |
(x,y), | |
(x,y) | |
.... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#controller這樣寫: | |
class ConsultantController << ApplicationController | |
# routing: post "consultant/create" => "consultant#create" | |
def create | |
Consultant.create params[:consultant] | |
end | |
end | |
#view這樣寫: | |
<form action="/consultant/create" method="post"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Client-side resizing example</title> | |
</head> | |
<body> | |
<input id="file-uploader" type="file"/> | |
<!-- <p>Image to use:</p> | |
<img id="cat" src="./cat.jpg" alt="The Scream" > --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.lb-conter a{ | |
color:#288bac; | |
text-decoration:underline; | |
} | |
.lb-conter a:hover{ | |
color:rgb(0, 153, 204); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre-headless -y | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below | |
# NEW WAY / EASY WAY | |
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.6.deb | |
sudo dpkg -i elasticsearch-0.20.6.deb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cart = [] | |
session[:cart].each do |key, value| | |
cart.push {product_id:key, amount:value} | |
end | |
Order.create cart |
OlderNewer