Skip to content

Instantly share code, notes, and snippets.

View SavvasStephanides's full-sized avatar

Savvas Stephanides SavvasStephanides

View GitHub Profile
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Pixelation
{
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Pixelate
{
@SavvasStephanides
SavvasStephanides / seven-segment-display-longest-word-nodejs.js
Last active October 10, 2018 20:47
NodeJS code to display the longest acceptable word that can be written on a seven-segment display.
var fileSystem = require("fs");
displayLongestAcceptableWord();
function displayLongestAcceptableWord(){
var longestAcceptableWords = getLongestAcceptableWords();
longestAcceptableWords.forEach(function(word){
console.log(word);
});
}
function sayHi(){
console.log("Hello!")
}
1
00:00:02,000 --> 00:00:08,000
This is some text
2
00:00:08,000 --> 00:00:10,000
This is some more text
3
00:00:10,000 --> 00:00:22,000
<div id="app">
<header>
<h1>Your cart</h1>
</header>
<main>
<div id="cart">
<i class="fas fa-shopping-cart"></i> 2 items in cart
</div>
</main>
</div>
<div id="app">
<header>
<h1>Your cart</h1>
</header>
<main>
<div id="cart">
<i class="fas fa-shopping-cart" aria-hidden="true"></i> 2 items in cart
</div>
</main>
</div>
@SavvasStephanides
SavvasStephanides / filterwithreduce.js
Created November 19, 2021 08:58
Implement 'filter' with reduce.
// Credit: Tweet from @oliverjumpertz: https://twitter.com/oliverjumpertz/status/1460184236917460993
// Filtering means: Test all elements of an array and take those with you that succeed the test
const filter = (array, callback) => array.reduce((accumulator, current, index, arr) => {
// This is the filter function. It decides which element is added to the new array
if (callback(current, index, arr)) {
// For each iteration, the current element is tested with the callback. If that test succeds
// it's added to the resulting array.
accumulator.push(current);
}
[
"ΑΚΑΝΘΟΥ",
"ΑΜΜΟΧΩΣΤΟΣ",
"ΛΕΥΚΟΝΟΙΚΟ",
"ΛΥΣΗ",
"ΚΑΡΑΒΑΣ",
"ΚΕΡΥΝΕΙΑ",
"ΛΑΠΗΘΟΣ",
"ΚΥΘΡΕΑ",
"ΛΕΥΚΑ",
$("#the-button")
.should(doSomething)
.when("clicked")