you are in: codestackercodes [RSS] → tag: twitter [RSS]

twitter-like input using css 3 Delicious Email

show/hide lines
   1  textarea {  
   2  	padding: 5px;  
   3  	font-size: 15px;  
   4  	text-shadow: 0px 1px 0px #fff;  
   5  	outline: none;  
   6  	-webkit-border-radius: 3px;  
   7  	-moz-border-radius: 3px;  
   8  	border-radius: 3px;  
   9  	border: 1px solid #ccc;  
  10  	-webkit-transition: .3s ease-in-out;  
  11  	-moz-transition: .3s ease-in-out;  
  12  }  
  13  
  14  textarea:focus {  
  15  	border: 1px solid #fafafa;  
  16  	-webkit-box-shadow: 0px 0px 6px #007eff;  
  17  	-moz-box-shadow: 0px 0px 5px #007eff;  
  18  	box-shadow: 0px 0px 5px #007eff;  
  19  }
created by leozera — 21 January 2011 — get a short url — tags: css css3 twitter embed

fetching tweets with jquery Delicious Email

show/hide lines
   1  $(document).ready(function() {
   2      // Declare variables to hold twitter API url and user name
   3      var twitter_api_url = 'http://search.twitter.com/search.json';
   4      var twitter_user    = 'leozera';
   5  
   6      // Enable caching
   7      $.ajaxSetup({ cache: true });
   8  
   9      // Send JSON request
  10      // The returned JSON object will have a property called "results" where we find
  11      // a list of the tweets matching our request query
  12      $.getJSON(
  13          twitter_api_url + '?callback=?&rpp=5&q=from:' + twitter_user,
  14          function(data) {
  15              $.each(data.results, function(i, tweet) {
  16                  // Uncomment line below to show tweet data in Fire Bug console
  17                  // Very helpful to find out what is available in the tweet objects
  18                  //console.log(tweet);
  19  
  20                  // Before we continue we check that we got data
  21                  if(tweet.text !== undefined) {
  22                      // Calculate how many hours ago was the tweet posted
  23                      var date_tweet = new Date(tweet.created_at);
  24                      var date_now   = new Date();
  25                      var date_diff  = date_now - date_tweet;
  26                      var hours      = Math.round(date_diff/(1000*60*60));
  27  
  28                      // Build the html string for the current tweet
  29                      var tweet_html = '<div class="tweet_text">';
  30                      tweet_html    += '<a href="http://www.twitter.com/';
  31                      tweet_html    += twitter_user + '/status/' + tweet.id + '">';
  32                      tweet_html    += tweet.text + '<\/a><\/div>';
  33                      tweet_html    += '<div class="tweet_hours">' + hours;
  34                      tweet_html    += ' hours ago<\/div>';
  35  
  36                      // Append html string to tweet_container div
  37                      $('#tweet_container').append(tweet_html);
  38                  }
  39              });
  40          }
  41      );
  42  });
created by leozera — 07 November 2010 — get a short url — tags: javascript twitter embed

post in twitter using rest_client Delicious Email

http://github.com/adamwiggins/rest-client

show/hide lines
   1  require "rubygems"
   2  require "rest_client"
   3  
   4  RestClient::Resource.new("http://twitter.com/statuses/update.json", :user => "user", :password => "pass").post :status => "Hello, there!"
created by leozera — 01 May 2010 — get a short url — tags: ruby twitter embed

jquery twitter Delicious Email

http://ralphwhitbeck.com/content/binary/twitter-json-jquery.html

show/hide lines
   1  <html>
   2  <head>
   3  <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
   4  <script>
   5  	$(document).ready( function() {
   6  	
   7  		var url = "http://twitter.com/status/user_timeline/RedWolves.json?count=3&callback=?";
   8  		$.getJSON(url,
   9          function(data){
  10  			$.each(data, function(i, item) {
  11  				$("img#profile").attr("src", item.user["profile_image_url"]); 
  12  				$("#tweets ul").append("<li>" + item.text.linkify() + " <span class='created_at'>" + relative_time(item.created_at) + " via " + item.source + "</span></li>");
  13  			});
  14          });
  15  	});
  16  	
  17  	String.prototype.linkify = function() {
  18  		return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
  19      return m.link(m);
  20    });
  21   }; 
  22    function relative_time(time_value) {
  23  	  var values = time_value.split(" ");
  24  	  time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
  25  	  var parsed_date = Date.parse(time_value);
  26  	  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
  27  	  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
  28  	  delta = delta + (relative_to.getTimezoneOffset() * 60);
  29  	  
  30  	  var r = '';
  31  	  if (delta < 60) {
  32  	    r = 'a minute ago';
  33  	  } else if(delta < 120) {
  34  	    r = 'couple of minutes ago';
  35  	  } else if(delta < (45*60)) {
  36  	    r = (parseInt(delta / 60)).toString() + ' minutes ago';
  37  	  } else if(delta < (90*60)) {
  38  	    r = 'an hour ago';
  39  	  } else if(delta < (24*60*60)) {
  40  	    r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';
  41  	  } else if(delta < (48*60*60)) {
  42  	    r = '1 day ago';
  43  	  } else {
  44  	    r = (parseInt(delta / 86400)).toString() + ' days ago';
  45  	  }
  46  	  
  47  	  return r;
  48  }
  49  function twitter_callback ()
  50  {
  51  	return true;
  52  }
  53  
  54  </script>	
  55  </head>
  56  <body>
  57  	<div id="tweets">
  58  		<img id="profile">
  59  		<ul></ul>
  60  	</div>
  61  </body>
  62  </html>
created by leozera — 10 May 2009 — get a short url — tags: javascript jquery twitter embed

jquery twitter plugin Delicious Email

from: http://www.tidbits.com.br/download/exemplos/jquery.twitter/jquery.twitter_original.zip

show/hide lines
   1  <script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
   2  <script type="text/javascript" src="jquery.twitter.js"></script>
   3  
   4  <script type="text/javascript">
   5  <!--//--><![CDATA[//><!--
   6  	$(document).ready(function() {
   7  		$("#twitter").getTwitter({
   8  			userName: "leozera",
   9  			numTweets: 5,
  10  			loaderText: "Loading tweets...",
  11  			slideIn: true,
  12  			showHeading: true,
  13  			headingText: "Latest Tweets",
  14  			showProfileLink: true
  15  		});
  16  	});
  17  //--><!]]>
  18  </script>
  19  
  20  <div id="twitter"></div>
  21  
created by leozera — 05 January 2009 — get a short url — tags: javascript jquery twitter embed

count chars (like twitter) Delicious Email

http://woork.blogspot.com/2008/07/useful-tips-to-enrich-your-html-forms.html

show/hide lines
   1  function countChars(idElement){
   2  max_chars = 20;
   3  counter = document.getElementById(idElement);
   4  field = document.getElementById('text').value;
   5  field_length = field.length;
   6  
   7  // Calculate remaining chars
   8  remaining_chars = max_chars-field_length;
   9  if(remaining_chars<=5){
  10  	counter.style.color="#CC0000";
  11  }
  12  // Update the counter on the page
  13  counter.innerHTML = remaining_chars;
  14  }
  15  
  16  // <input type="input" id="text" onKeyUp="javascript:countChars('counter_number')"/> <spam id="counter_number">20</spam>
created by leozera — 22 November 2008 — get a short url — tags: count javascript twitter embed

post in twitter using curl Delicious Email

show/hide lines
   1  curl -u email:password -d status="hello world!" http://twitter.com/statuses/update.xml 
created by leozera — 16 November 2008 — get a short url — tags: curl twitter embed

mac os reading twitter updates Delicious Email

show/hide lines
   1  require 'rss/1.0'
   2  require 'rss/2.0'
   3  require 'open-uri'
   4  
   5  content = ''
   6  open('http://twitter.com/statuses/user_timeline/peepcode.rss').each { |i| content << i }
   7  RSS::Parser.parse(content).items.each { |i| system "say \"#{i.title}\"" }
created by leozera — 09 July 2008 — get a short url — tags: mac ruby twitter embed