Skip to content

Instantly share code, notes, and snippets.

View gabri83's full-sized avatar
💭
Keep it simple as much as you can!

Gabriele gabri83

💭
Keep it simple as much as you can!
  • GSMA
  • London
  • 05:58 (UTC +01:00)
View GitHub Profile
@gabri83
gabri83 / arraySorting.js
Created August 13, 2025 08:11
Sorting an Array of Numbers (JavaScript)
const numbers = [5, 2, 9, 1];
numbers.sort((a, b) => a - b);
console.log(numbers); // [1, 2, 5, 9]
@gabri83
gabri83 / debounce.js
Created August 13, 2025 08:12
Debounce Function (JavaScript) 
function debounce(fn, delay) {
let timer;
return function(...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
}
@gabri83
gabri83 / readFile.js
Last active August 13, 2025 08:13
Read a File Line by Line (Node.js)
const fs = require('fs');
fs.readFile('example.txt', 'utf8', (err, data) => {
if (err) throw err;
data.split('\n').forEach(line => {
console.log(line);
});
});
@gabri83
gabri83 / HTTP_GET_Request.py
Created August 13, 2025 08:14
HTTP GET Request (Python) 
import requests
response = requests.get('https://api.github.com')
print(response.json())
@gabri83
gabri83 / JSON2CSV.js
Created August 13, 2025 08:15
Convert JSON to CSV (JavaScript) 
const json = [{ name: "Alice", age: 25 }, { name: "Bob", age: 30 }];
const csv = [
Object.keys(json[0]).join(','),
...json.map(row => Object.values(row).join(','))
].join('\n');
console.log(csv);
@gabri83
gabri83 / TypeGuard.ts
Created August 13, 2025 08:16
TypeScript: Type Guard Function
function isString(value: unknown): value is string {
return typeof value === 'string';
}
@gabri83
gabri83 / responsiveImage.html
Created August 13, 2025 08:16
HTML: Responsive Image
<img src="image.jpg" alt="Description" style="max-width:100%;height:auto;">
@gabri83
gabri83 / elementCentered.css
Created August 13, 2025 08:17
CSS: Center an Element Vertically and Horizontally 
.centered {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
@gabri83
gabri83 / listComprehension.py
Created August 13, 2025 08:18
Python: List Comprehension for Filtering
numbers = [1, 2, 3, 4, 5]
evens = [n for n in numbers if n % 2 == 0]
print(evens) # [2, 4]
@gabri83
gabri83 / expressServer.js
Created August 13, 2025 08:18
Node.js: Simple Express Server
const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('Hello World!'));
app.listen(3000, () => console.log('Server running on port 3000'));