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
socket.on('chat message', function(msg){ | |
$('#messages').append(msg); | |
window.scrollTo(0, document.body.scrollHeight); | |
}); |
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 socket = io(); | |
$('form').submit(function(){ | |
socket.emit('chat message', "<div class='msg-ping'>Ping:" + $('#m').val() + "</div>"); | |
$('#m').val(''); | |
return false; | |
}); |
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.post('/successfulNotification', function (req, res) { | |
res = res.status(200); | |
res.send(req.body); | |
try { | |
var htmlHeader = prettyHtml(req.headers, req.body.dimensions); | |
var htmlBody = prettyHtml(JSON.parse(req.body), req.body.dimensions); | |
io.emit('chat message', '<div class="msg-header-success">Successful Notification received at:' | |
+ formatDate(new Date(), "dddd h:mm:sstt d MMM yyyy") +'</div>'); |
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
const express = require('express') | |
const app = express() | |
// set the public folder, place for static files. | |
app.use(express.static(__dirname + '/public')); |
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
from twitter_auth import API_KEY, API_SECRET | |
import tweepy as tp | |
from datetime import datetime | |
import csv | |
import time | |
SOURCE_KEYWORDS = 'ireland alcohol' + ' -filter:retweets' | |
auth = tp.OAuth2AppHandler( | |
API_KEY, API_SECRET |
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
private static List<Integer> getIntegerList2(List<Integer> numbers) { | |
return numbers | |
.stream() | |
.map( | |
number -> | |
CompletableFuture.supplyAsync( | |
() -> getNumberCalculation(number), | |
executor | |
) | |
) |
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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import java.util.stream.Collectors; |
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
private static List<Integer> getIntegerList(List<Integer> numbers) throws InterruptedException { | |
return numbers | |
.stream() | |
.map( | |
number -> | |
CompletableFuture.supplyAsync( | |
() -> getNumberCalculation(number), | |
executor | |
) | |
) |
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
package weekOne; | |
import org.junit.After; | |
import org.junit.Assert; | |
import org.junit.Before; | |
import org.junit.Test; | |
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.InputStream; |
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
private static final String OSWALD_ALONE = "Oswald acted alone"; | |
private static final String FAVORITE_MOVIE = "matrix"; | |
private static final String MOVIE_RATE_VALUE = "5"; | |
private static final String MOVIE_RATE = "Move rating is: " + MOVIE_RATE_VALUE; | |
@Test | |
public void itTestFilmRating() { | |
InputStream in = new ByteArrayInputStream(MOVIE_RATE_VALUE.getBytes()); | |
System.setIn(in); |