Skip to content

Instantly share code, notes, and snippets.

View SavvasStephanides's full-sized avatar

Savvas Stephanides SavvasStephanides

View GitHub Profile
@SavvasStephanides
SavvasStephanides / libreoffice-in-docker.sh
Last active October 3, 2024 07:58
LibreOffice in Docker
docker run --rm -d \
-p 3000:3000 \
-p 3001:3001 \
lscr.io/linuxserver/libreoffice:latest
services:
web:
image: bitnami/laravel
volumes:
- ./app:/app
working_dir: /app
environment:
- LARAVEL_DATABASE_HOST=db
- LARAVEL_DATABASE_USER=root
- LARAVEL_DATABASE_NAME=laravel
// This is your original array:
const animals = ['panda', 'turtle', 'giraffe'];
function convertToBaby(animalsArray){
// Start with an empty array. You will populate these in your loop:
const babyAnimals = [];
// Since it specifically asks for a loop:
for(var i = 0 ; i < animals.length ; i++){
// push() basically adds something at the end of an array:
babyAnimals.push(`baby ${animalsArray[i]`)
@SavvasStephanides
SavvasStephanides / Dockerfile
Created December 14, 2023 18:49
Accessibility audit Dockerfile
FROM buildkite/puppeteer:v1.15.0
RUN npm install --global --unsafe-perm pa11y-ci
RUN groupadd -r user && useradd -r -g user user
USER user
ENTRYPOINT ["pa11y-ci"]
@SavvasStephanides
SavvasStephanides / hello.js
Last active October 29, 2022 18:04
console-hello.js
console.log("Hello 👋");
.parent {
display: flex;
justify-content: center;
align-items: center;
}
const axios = require("axios")
const jsdom = require("jsdom")
const { JSDOM } = jsdom
async function run(){
const url = "https://savvas.me/explained/promises"
let response = await axios.get(url)
let html = response.data
$("#the-button")
.should(doSomething)
.when("clicked")
[
"ΑΚΑΝΘΟΥ",
"ΑΜΜΟΧΩΣΤΟΣ",
"ΛΕΥΚΟΝΟΙΚΟ",
"ΛΥΣΗ",
"ΚΑΡΑΒΑΣ",
"ΚΕΡΥΝΕΙΑ",
"ΛΑΠΗΘΟΣ",
"ΚΥΘΡΕΑ",
"ΛΕΥΚΑ",
@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);
}