Created
January 3, 2012 16:37
-
-
Save peterdm/1555676 to your computer and use it in GitHub Desktop.
Revisions
-
wheresalice revised this gist
Apr 6, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,7 @@ html(lang="en") //alert('recieved ' + message['text']); message['text'] = message['text'].replace(/<.*?>/g,''); $('<li>' + message['text'] + '</li>').appendTo('ul#messages'); $('html,body').animate({ scrollTop: document.height }, 'slow'); }); $('form#compose').submit(function() { sendmessage(); -
wheresalice revised this gist
Apr 6, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,8 +10,8 @@ html(lang="en") var client = new Faye.Client('http://fayechat.kaerast.info/faye'); var subscription = client.subscribe('/messages', function(message) { //alert('recieved ' + message['text']); message['text'] = message['text'].replace(/<.*?>/g,''); $('<li>' + message['text'] + '</li>').appendTo('ul#messages'); }); $('form#compose').submit(function() { sendmessage(); -
wheresalice revised this gist
Apr 6, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ html(lang="en") var client = new Faye.Client('http://fayechat.kaerast.info/faye'); var subscription = client.subscribe('/messages', function(message) { //alert('recieved ' + message['text']); //message['text'] = message['text'].replace(/<.*?>/g,''); $('<li>' + message['text'] + '</li>').appendTo('ul#messages'); }); $('form#compose').submit(function() { -
wheresalice revised this gist
Apr 6, 2011 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,8 @@ html(lang="en") var client = new Faye.Client('http://fayechat.kaerast.info/faye'); var subscription = client.subscribe('/messages', function(message) { //alert('recieved ' + message['text']); message['text'] = message['text'].replace(/<.*?>/g,''); $('<li>' + message['text'] + '</li>').appendTo('ul#messages'); }); $('form#compose').submit(function() { sendmessage(); -
wheresalice revised this gist
Apr 6, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ html(lang="en") var client = new Faye.Client('http://fayechat.kaerast.info/faye'); var subscription = client.subscribe('/messages', function(message) { //alert('recieved ' + message['text']); $('<li>' + message['text'] + '</li>').appendTo('ul#messages'); }); $('form#compose').submit(function() { sendmessage(); -
wheresalice revised this gist
Apr 6, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ html(lang="en") var client = new Faye.Client('http://fayechat.kaerast.info/faye'); var subscription = client.subscribe('/messages', function(message) { //alert('recieved ' + message['text']); $('<li>' + message['text'].replace(/<\/?[^>]+(>|$)/g, "") + '</li>').appendTo('ul#messages'); }); $('form#compose').submit(function() { sendmessage(); -
wheresalice revised this gist
Apr 6, 2011 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,14 +29,18 @@ html(lang="en") h1 Node/Faye/Jade Tech Demo p | Uses a(href='http://www.dotcloud.com') Dotcloud | for hosting, a(href='http://nodejs.org') Node.js | as the server, a(href='http://faye.jcoglan.com/') Faye | for pub/sub and a(href='http://jade-lang.com/') Jade | for template rendering p | Source code is available in a(href='https://gist.github.com/901738') git | . We also have a shiney API (for free): p code curl http://fayechat.kaerast.info/faye -d 'message={"channel":"/messages", "data":{"text":"hello world"}}' ul#messages -
Ubuntu revised this gist
Apr 6, 2011 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,8 +35,10 @@ html(lang="en") | for pub/sub and a(href='http://jade-lang.com/') Jade | for template rendering p Source code is available in a(href='https://gist.github.com/901738') git p code curl http://fayechat.kaerast.info/faye -d 'message={"channel":"/messages", "data":{"text":"hello world"}}' ul#messages li messages will appear here form#compose(action='javascript:return false;') -
Ubuntu revised this gist
Apr 6, 2011 . 4 changed files with 10 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ www: requirements: - faye - jade This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,4 +18,4 @@ var server = http.createServer(function(request, response) { }); bayeux.attach(server); server.listen(8080); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,10 @@ html(lang="en") title= "Node/Faye/Jade Tech Demo" link(href='http://cachedcommons.org/cache/blueprint/0.9.1/stylesheets/screen-min.css', type='text/css', rel='stylesheet') script(type='text/javascript', src='http://cachedcommons.org/cache/jquery/1.4.2/javascripts/jquery-min.js') script(type='text/javascript', src='http://fayechat.kaerast.info/faye.js') script(type='text/javascript') $(function() { var client = new Faye.Client('http://fayechat.kaerast.info/faye'); var subscription = client.subscribe('/messages', function(message) { //alert('recieved ' + message['text']); $('<li>' + message['text'] + '</li>').appendTo('ul#messages'); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ [program:node] command = node faye.js directory = /home/dotcloud/current -
Ubuntu revised this gist
Apr 4, 2011 . 1 changed file with 8 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,13 +12,16 @@ html(lang="en") //alert('recieved ' + message['text']); $('<li>' + message['text'] + '</li>').appendTo('ul#messages'); }); $('form#compose').submit(function() { sendmessage(); }); function sendmessage() { var compose = $('input[name$="compose"]').val(); client.publish('/messages', {text: compose}); $('input[name$="compose"]').val(''); $('input[name$="compose"]').focus(); //alert('sending ' + compose); }; $('input[name$="compose"]').focus(); }); body @@ -36,5 +39,6 @@ html(lang="en") code curl http://127.0.0.1:8000/faye -d 'message={"channel":"/messages", "data":{"text":"hello world"}}' ul#messages li messages will appear here form#compose(action='javascript:return false;') input(type='text', name='compose') input(type='submit', name='send', value='send') -
Ubuntu revised this gist
Apr 4, 2011 . 1 changed file with 16 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,19 +2,28 @@ html(lang="en") head title= "Node/Faye/Jade Tech Demo" link(href='http://cachedcommons.org/cache/blueprint/0.9.1/stylesheets/screen-min.css', type='text/css', rel='stylesheet') script(type='text/javascript', src='http://cachedcommons.org/cache/jquery/1.4.2/javascripts/jquery-min.js') script(type='text/javascript', src='http://109.107.36.225:8000/faye.js') script(type='text/javascript') $(function() { var client = new Faye.Client('http://109.107.36.225:8000/faye'); var subscription = client.subscribe('/messages', function(message) { //alert('recieved ' + message['text']); $('<li>' + message['text'] + '</li>').appendTo('ul#messages'); }); $('input[name$="send"]').click(function() { var compose = $('input[name$="compose"]').val(); client.publish('/messages', {text: compose}); $('input[name$="compose"]').val(''); $('input[name$="compose"]').focus(); //alert('sending ' + compose); }); $('input[name$="compose"]').focus(); }); body .container h1 Node/Faye/Jade Tech Demo p | Uses a(href='http://nodejs.org') Node.js @@ -24,6 +33,8 @@ html(lang="en") a(href='http://jade-lang.com/') Jade | for template rendering p code curl http://127.0.0.1:8000/faye -d 'message={"channel":"/messages", "data":{"text":"hello world"}}' ul#messages li messages will appear here input(type='text', name='compose') input(type='button', name='send', value='send') -
Ubuntu revised this gist
Apr 4, 2011 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,11 +2,15 @@ html(lang="en") head title= "Node/Faye/Jade Tech Demo" script(type='text/javascript', src='http://cachedcommons.org/cache/jquery/1.4.2/javascripts/jquery-min.js') script(type='text/javascript', src='http://109.107.36.225:8000/faye.js') script(type='text/javascript') $(function() { var client = new Faye.Client('http://109.107.36.225:8000/faye'); var subscription = client.subscribe('/messages', function(message) { //alert(message); $('<li>' + message + '</li>').appendTo('ul#messages'); }); }); body h1 Node/Faye/Jade Tech Demo @@ -21,3 +25,5 @@ html(lang="en") | for template rendering p code curl http://127.0.0.1:8000/faye -d 'message={"channel":"/messages", "data":"buzz"}' ul#messages li messages will appear here -
Alice Kærast created this gist
Apr 4, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ var http = require('http'), faye = require('faye'), jade = require ('jade'), fs = require('fs'); var template = fs.readFileSync('index.jade', 'utf8'); var bayeux = new faye.NodeAdapter({ mount: '/faye', timeout: 45 }); // Handle non-Bayeux requests var server = http.createServer(function(request, response) { response.writeHead(200, {'Content-Type': 'text/html'}); //response.write(Haml.render(haml)); response.write(jade.render(template)); response.end(); }); bayeux.attach(server); server.listen(8000); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ !!! 5 html(lang="en") head title= "Node/Faye/Jade Tech Demo" script(type='text/javascript', src='http://109.107.36.225:8000/faye.js') script(type='text/javascript') var client = new Faye.Client('http://109.107.36.225:8000/faye'); var subscription = client.subscribe('/messages', function(message) { alert(message); }); body h1 Node/Faye/Jade Tech Demo #container p | Uses a(href='http://nodejs.org') Node.js | as the server, a(href='http://faye.jcoglan.com/') Faye | for pub/sub and a(href='http://jade-lang.com/') Jade | for template rendering p code curl http://127.0.0.1:8000/faye -d 'message={"channel":"/messages", "data":"buzz"}'