Skip to content
Browse files

WIP

  • Loading branch information...
1 parent 61f4545 commit 38396350f11a2118a4785409689732e3c7e994f7 @sleeper committed Jan 25, 2012
Showing with 20 additions and 6 deletions.
  1. +14 −0 demo/static/css/twitsock.css
  2. +5 −1 demo/static/scripts/twitsock.js
  3. +1 −5 demo/twitsock.rb
View
14 demo/static/css/twitsock.css
@@ -1,5 +1,19 @@
@font-face { font-family: 'Terminal Dosis'; src: url('TerminalDosis-SemiBold.ttf'); }
+@-webkit-keyframes roll {
+ from { -webkit-transform: rotate(0deg) }
+ to { -webkit-transform: rotate(360deg) }
+}
+
+.roll {
+ -moz-animation-name: roll;
+ -moz-animation-duration: 4s;
+ -moz-animation-iteration-count: 1;
+ -webkit-animation-name: roll;
+ -webkit-animation-duration: 4s;
+ -webkit-animation-iteration-count: 1;
+}
+
body, html {
margin: 0;
padding: 0;
View
6 demo/static/scripts/twitsock.js
@@ -14,8 +14,12 @@ $(document).ready(function() {
var record = $.parseJSON(evt.data);
var user = record.name;
var rx = regexs[record.search];
- var msg = record.tweet.replace( rx, "<span class='highlight'>$1</span>");
+ var txt = record.tweet;
+ var msg = txt.replace( rx, "<span class='highlight'>$1</span>");
$('#tweets').prepend(generate_string(user, msg));
+ if ( txt =~ /ruby/ ) {
+ $('body').addClass('roll');
+ }
}
$('#go').click(function() {
View
6 demo/twitsock.rb
@@ -21,7 +21,6 @@ def on_open(env)
# Join the channel
env[:tbuffer] = ""
env[:subscription] = env.channel.subscribe {|m| env.stream_send(m.force_encoding("BINARY")) }
- puts "FRED: Connection to ws"
end
def on_message(env, msg)
@@ -35,7 +34,7 @@ def on_message(env, msg)
http = EventMachine::HttpRequest.new(FIREHOSE).post(req)
http.errback { puts 'Uh oh' }
- http.stream do |chunk|
+ http.stream do |chunk|
env[:tbuffer] += chunk
while line = env[:tbuffer].slice!(/.+\r?\n/)
if line.length > 5
@@ -64,9 +63,6 @@ def response(env)
end
end
-puts "FRED: Default encoding: " + "foo".encoding.to_s
-
-
class TwitSock < Goliath::API
use Rack::Static, :urls => ['/scripts','/images','/css'], :root => Goliath::Application.app_path("static")

0 comments on commit 3839635

Please sign in to comment.
Something went wrong with that request. Please try again.