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
///// it doesnt work sometimes ///// |
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 { nanoid } = require('nanoid'), | |
express = require('express'), | |
multer = require('multer'), | |
fs = require('fs'), | |
app = express() | |
const uploads = multer({ dest: 'static/' }) | |
app | |
.use(express.static('static')) |
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 drawMatrix(size, defaultValue) { | |
return Array(size).fill(defaultValue).map(()=>Array(size).fill(defaultValue)); | |
}; | |
function fillRectangle(x, y, width, height, matrix) { | |
for (let i = x; i < x + width; i++) { | |
for (let j = y; j < y + height; j++) { | |
matrix[i][j] = 1; | |
}; | |
}; |
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
// This is the way it comes to my mind in 10 seconds, | |
// there are should be better ways to do it faster but | |
// I want to make this as a one liner sooo.. yeah! | |
for(let i=1;i<101;i++){console.log((i%3==0&&i%15!==0)?'fizz':(i%5==0&&i%15!==0)?'buzz':i%15==0?'fizzbuzz':'')} |
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
// No need for PHP APIs when you have nodejs :) | |
const fetch = require('node-fetch'); | |
const crypto = require('crypto'); | |
const moment = require('moment'); | |
let url = 'http://www.koeri.boun.edu.tr/scripts/lst2.asp'; | |
fetch(url) | |
.then(res => res.text()) | |
.then(body => { |
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 fetch = require('node-fetch'); | |
const regex = /<link rel="canonical" href="(https?:\/\/)?(www\.)?youtube\.com\/(channel|user)\/[\w-]+">/g | |
fetch('https://www.youtube.com/channel/UCa10nxShhzNrCE1o2ZOPztg') | |
.then(res => res.text()) | |
.then(body => console.log(body.match(regex)[0].split(" ")[2].replace('href=\"', '').replace('\">', '').split("/")[4])) | |
// Expected output: | |
// UCa10nxShhzNrCE1o2ZOPztg |