Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Campfire Bot

   1  
   2  // ==UserScript==
   3  // @name Campfire Bot
   4  // @namespace http://d.hatena.ne.jp/youpy/
   5  // @description bot on campfire
   6  // @include http://*.campfirenow.com/room/*
   7  // ==/UserScript==
   8  
   9  (function (){
  10      getLastMessage = function() {
  11  	div = document.evaluate("//tr[contains(@class,'text_message') and not(contains(@class,'you'))]/td[@class='body']/div", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  12  	return div.snapshotItem(div.snapshotLength - 1).innerHTML;
  13  	
  14      }
  15      
  16      window.setInterval(
  17  		       function() {
  18  			   last_message = getLastMessage();
  19  			   if(this.last_message != (sorted = last_message.split('').sort().join(''))) {
  20  			       this.last_message = sorted;
  21  			       if(last_message.match(/^\//)) {
  22  				   switch(last_message) {
  23  				   case '/now':
  24  				       this.chat.speaker.speak(new Date().toString());
  25  				       break;
  26  				   }
  27  			       } else  {
  28  				   this.chat.speaker.speak(last_message.split('').reverse().join(''));
  29  			       }
  30  
  31  			   }
  32  		       }, 3000);
  33  })();


residents at here

audible web browsing

You need to install esound.
   1  
   2  $ esd -public -tcp &
   3  $ sudo /usr/sbin/tcpdump -w - port 80 | esdcat -r 5000 -s 127.0.0.1 < /dev/stdin
   4  
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS