Skip to content

Instantly share code, notes, and snippets.

View sehmbimanvir's full-sized avatar

Manvir Singh sehmbimanvir

View GitHub Profile
@sehmbimanvir
sehmbimanvir / scrap-1.php
Last active May 17, 2020 13:18
Scrap All Repositories
<?php
$data = $crawler->filter('article.Box-row')->each(function ($node) {
$anchorNode = $node->filter('h1 > a');
$data['title'] = $anchorNode->text();
$data['link'] = $anchorNode->attr('href');
$data['stars'] = $node->filter('div.text-gray > a')->text();
return $data;
});
const express = require('express');
const crypto = require('crypto');
require('dotenv/config');
const app = express();
app.use(express.json());
app.post('/mentor', function (req, res) {
const { SECRET_KEY } = process.env
const { body, headers } = req
@sehmbimanvir
sehmbimanvir / recursion-deep-copy.js
Created March 18, 2022 17:14
Javascript Deep Copy using Recursion
const deepCopy = data => {
if (typeof data !== "object" || !data) return data;
let result = Array.isArray(data) ? [] : {};
for (let i in data) result[i] = deepCopy(data[i]);
return result;
};