Skip to content

Instantly share code, notes, and snippets.

2 Chainz and Wiz Khalifa - We Own It
4 Non Blondes - What's Up .mp4
5 Seconds Of Summer - Amnesia
5 Seconds Of Summer - Beside You
5 Seconds Of Summer - Don't Stop
5 Seconds Of Summer - Good Girls
5 Seconds Of Summer - Heartbreak Girl
5 Seconds Of Summer - Hey Everybody!
5 Seconds Of Summer - Jet Black Heart
5 Seconds Of Summer - She Looks So Perfect
const chunk = (items, chunkSize) =>
[...Array(Math.round(items.length / chunkSize))]
.map((_, index) =>
items.slice(
index * chunkSize,
index * chunkSize + chunkSize))
// chunk([1,2,3,4,5], 2)
// [[1,2], [3,4], [5]]
@Jekins
Jekins / Markdown-docs.md
Last active April 27, 2024 05:29
Руководство по оформлению Markdown файлов

Руководство по оформлению Markdown файлов

Markdown - это облегчённый язык разметки, который преобразует текст в структурированный HTML. Следующее руководство поможет вам разобраться, как использовать Markdown.

Заголовки

# Заголовок первого уровня
## Заголовок второго уровня
### Заголовок третьего уровня
#### Заголовок четвёртого уровня
##### Заголовок пятого уровня
const createAppsConfig = configFiles => ({
...configFiles,
config: configFiles.appInstances,
list: partial(list, [configFiles]),
get: partial(get, [configFiles]),
create: partial(create, [configFiles]),
edit: partial(edit, [configFiles]),
remove: partial(remove, [configFiles]),
update: partial(update, [configFiles]),
initApps: partial(initApps, [configFiles]),
@senthilmpro
senthilmpro / async-time-delay.js
Created May 3, 2018 17:11
Asynchronously (await) delay timer
function delay(timeout) {
return new Promise((resolve) => {
setTimeout(resolve, timeout);
});
}
/**
* then use it like this.
* async function f1() {
* await delay(3000);
@senthilmpro
senthilmpro / script-replace-selector-content.js
Created May 3, 2018 17:10
Replace HTML Selector inner text/ content via Google Puppeteer script
async function setSelectVal(sel, val) {
await page.evaluate((data) => {
// this innerHTML can be replaced with .value (based on HTML type)
return document.querySelector(data.sel).innerHTML = data.val;
}, {sel, val});
}
@senthilmpro
senthilmpro / download-file-axios.js
Last active April 27, 2024 05:26
Download files using Axios.js
/**
* Download files and save it to disk using axios.js
* Download images, zip files using this function
*
* @param {Request URL} reqUrl
* @param {File name} fileName
*/
function downloadFile(reqUrl, fileName){
axios({
method: "GET",
@senthilmpro
senthilmpro / mongo-db-connect.js
Created November 27, 2018 22:34
Node.js MongoDB connect
var db = null // global variable to hold the connection
MongoClient.connect('mongodb://localhost:27017/', function(err, client) {
if(err) { console.error(err) }
db = client.db('test') // once connected, assign the connection to the global variable
})
app.get('/', function(req, res) {
db.collection('test').find({}).toArray(function(err, docs) {
if(err) { console.error(err) }
@senthilmpro
senthilmpro / host-local-files.js
Created March 28, 2019 04:25
host local files serve-index
var express = require('express'),
directory = require('serve-index'),
app = new express();
var hourMs = 1000*60*60;
app.use(express.static(__dirname + '/public', { maxAge: hourMs }));
app.use(directory(__dirname + '/public', { 'view' : 'details'}));
app.listen(4433);
@senthilmpro
senthilmpro / create-acc-arch1ve-new.js
Last active April 27, 2024 05:26
create-acc-arch1ve-new.js
async function createAccount(){
var USER_PREFIX = 'USERNAME'; // change here.
var USER_PASS = 'PASSWORD'; // change-here
var TIMER_DELAY = 400;
// username
await delay(TIMER_DELAY);
var randomGuid = guid();