This file contains 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 characters
function addMessage(msg, pseudo, date, self) { | |
if(self) var classDiv = "row message self"; | |
else var classDiv = "row message"; | |
$("#chatEntries").append('<div class="'+classDiv+'"><p class="infos"><span class="pseudo">'+pseudo+'</span>, <time class="date" title="'+date+'">'+date+'</time></p><p>' + msg + '</p></div>'); | |
time(); | |
} |
This file contains 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 characters
var messageContainer, submitButton; | |
var pseudo = ""; | |
$(function() { | |
messageContainer = $('#messageInput'); | |
submitButton = $("#submit"); | |
bindButton(); | |
window.setInterval(time, 1000*10); | |
$("#alertPseudo").hide(); |
This file contains 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 characters
io.sockets.on('connection', function (socket) { | |
users += 1; | |
reloadUsers(); | |
socket.on('message', function (data) { | |
if(pseudoSet(socket)) | |
{ | |
var transmit = {date : new Date().toISOString(), pseudo : socket.nickname, message : data}; | |
socket.broadcast.emit('message', transmit); | |
console.log(transmit['pseudo'] +" "+data+" yazdı"); | |
} |
This file contains 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 characters
app.get('/', function(req, res){ | |
res.render('home.jade'); | |
}); | |
server.listen(appPort); | |
console.log(appPort + " portu dinleniyor"); |
This file contains 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 characters
var appPort = 3000; | |
var express = require('express'), app = express(); | |
var http = require('http') | |
, server = http.createServer(app) | |
, io = require('socket.io').listen(server); | |
var jade = require('jade'); | |
var pseudoArray = ['admin']; |
This file contains 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 characters
var http = require('http'); | |
var port='3000'; | |
var server=http.createServer(function(request,response){ | |
response.end("Merhaba Dunya"); | |
}); |
This file contains 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 characters
read = function(err, db) | |
{ | |
if(err){ | |
console.log("Database açılmadı" + err); | |
} | |
else | |
{ | |
var PARSE_JSON = parse_json.bind(this); | |
collections.find().toArray(PARSE_JSON); |
This file contains 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 characters
write_db = function(err, db){ | |
for(i=0; i<mydata.length; i++){ | |
collections.insert({ | |
Name: mydata[i].user.name, | |
Tweets: mydata[i].text, | |
Date: mydata[i].created_at, | |
Location: mydata[i].user.location | |
}); | |
} | |
} |
This file contains 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 characters
get_tweets = function (req, res){ | |
query = req.query.search; | |
var display_data = get_data.bind(res); | |
T.get('search/tweets', { q: query, count:100 }, display_data ); | |
} |
This file contains 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 characters
var T = new Twit({ | |
consumer_key: 'GzM2G202zP4Lo04kAFoP4TmEa' | |
, consumer_secret: 'aJBOMYk96ZUUriLtvhP0ecAuGmw9pN38xdj69iGaq8OZpk8R1f' | |
, access_token: '738778154458873857-p07JICMlD6NjtSOmOgamQrJYvTC6R2I' | |
, access_token_secret: 'E163HSitSwcZ3VDaqZqQuQ2Wviw0QqZULKsSH2655gRU1' | |
}); |
NewerOlder