Skip to content

Instantly share code, notes, and snippets.

View toamitkumar's full-sized avatar
🏠
Working from home

Amit Kumar toamitkumar

🏠
Working from home
View GitHub Profile
@toamitkumar
toamitkumar / feedback.js
Created March 30, 2012 02:10
venkateshn
Ajax:
twitter.html
1.
<input id="TWEET" type=button value="Get Tweets" "/>
# Always try to use small case for 'id' attributes. Standard coding practice
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.
@toamitkumar
toamitkumar / feedback.js
Created March 30, 2012 02:03
GopinathS
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.
@toamitkumar
toamitkumar / feedback.js
Created March 30, 2012 01:57
ashutoshdikshit
Day 1
Form.html
Excellent. Inline CSS and JS is bad practice. Always create files and include them.
Day 2:
Tweets.html
1.
@toamitkumar
toamitkumar / feedback.js
Created March 30, 2012 01:37
Deolina D
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.
class SomeRandomClass
def caller
string = ""
string = first(string)
string = second(string)
third(string)
end
def first(string)
# update the string
/*
* 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("/");
/* 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);
<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>
@toamitkumar
toamitkumar / gist:1648360
Created January 20, 2012 16:53
Invalid gemspec in” and “Illformed requirement”
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