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
Ajax: | |
twitter.html | |
1. | |
<input id="TWEET" type=button value="Get Tweets" "/> | |
# Always try to use small case for 'id' attributes. Standard coding practice |
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
Day 1: | |
1. | |
Excellent. Like the clear separation of html, css and js. | |
2. | |
$("<li>"+data[i].text+"</li>").appendTo("#ulTweets").hide(); | |
# This will add "li" to the DOM inside loop. Not good for performance. | |
# Its better to build a string inside a loop and add the whole string to the DOM outside of loop. |
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
Day 1: | |
twitt.html (or tweet.html, probably a typo) | |
1. | |
Always try to use small case for 'id' attributes. Standard coding practice | |
2. | |
Inline CSS and JS is bad practice. Always create files and include them. |
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
Day 1 | |
Form.html | |
Excellent. Inline CSS and JS is bad practice. Always create files and include them. | |
Day 2: | |
Tweets.html | |
1. |
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
Day 1: | |
GetTweets | |
1. | |
var n = $('<li />').appendTo(tweetList).text(feed[i].text); | |
# This will add "li" to the DOM inside loop. Not good for performance. | |
# Its better to build a string inside a loop and add the whole string to the DOM outside of loop. | |
2. |
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
class SomeRandomClass | |
def caller | |
string = "" | |
string = first(string) | |
string = second(string) | |
third(string) | |
end | |
def first(string) | |
# update the string |
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
/* | |
* The code on the server side has content disposition as attachment | |
* It adds a cookie for the filedownload status | |
* remember to flush the response | |
*/ | |
response.setHeader("Content-Disposition", "attachment; filename="+downloadFileName); | |
Cookie cookie = new Cookie("fileDownloadStatus", "complete"); | |
cookie.setPath("/"); |
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
/* https://github.com/carhartl/jquery-cookie */ | |
$("a.linkDownload").click(function(event) { | |
.... other action on click of link | |
$(this).bindDownloadEvents(event); // bind the form submit event | |
}); | |
$.fn.bindDownloadEvents = function(event) { | |
event.preventDefault(); | |
showDownloadIndicator(this); |
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
<iframe height='0px' id='exportIFrame' name='exportIFrame' style='visibility:hidden' width='0px'></iframe> | |
<form action='url to form submit' id='exportForm' method='post' name='exportForm' target='exportIFrame'> | |
<input id='attr1' name='attr1' type='hidden'> | |
<input id='attr2' name='attr2' type='hidden'> | |
<textarea id='json' name='json' style='visibility:hidden'></textarea> | |
</form> | |
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
Steps: | |
If you are using RVM, then follow the steps below: | |
1. Clear your gemset | |
$ rvm gemset empty | |
2. Update to the latest version of rubygems | |
$ gem update --system |