Skip to content

Instantly share code, notes, and snippets.

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

Amitav Roy amitavroy

🏠
Working from home
View GitHub Profile
@amitavroy
amitavroy / gist:5748254
Created June 10, 2013 12:03
Get all tweets of a specific hashtag
function getTweets($hash_tag) {
$url = 'http://search.twitter.com/search.atom?q='.urlencode($hash_tag) ;
echo "<p>Connecting to <strong>$url</strong> ...</p>";
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
$xml = curl_exec ($ch);
curl_close ($ch);
//If you want to see the response from Twitter, uncomment this next part out:
@amitavroy
amitavroy / ga_event.js
Created March 27, 2013 14:18
This code shows how to add an event to a click or other user event.
$('.tab').click(function() {
$(this).show();
var eventCategory = jQuery(this).attr('data-category');
var eventAction = jQuery(this).attr('data-action');
var eventLabel = window.document.title;
_gaq.push(['_trackEvent', eventCategory, eventAction, eventLabel]);
});
@amitavroy
amitavroy / infinitescroll.js
Created March 25, 2013 11:44
This code is used to generate an infinite scroll. It appends the new data to the container. Need to work on providing an animation when the data is being fetched.
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
// calling the function to get the ajax data
loadMore();
}
});
function loadMore() {
$.ajax({
url: base_url + "/infscroll/get_inf_scroll_ajax",