Skip to content

Instantly share code, notes, and snippets.

View vamshi9666's full-sized avatar
🎯
Focusing

Vamshi krishna vamshi9666

🎯
Focusing
View GitHub Profile
const input_array = [[1,2,[3]],4]
function flatten(arr) {
return arr.reduce(function (flat, toFlatten) {
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
}, []);
}
flatten(input_array)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmLBr+Ua1zhmtOGOmiZUPzW92+IE/j4gtn6ifRx+SNOR1iJIE/9e44hKmW2p/BVvhXynUJOy9xMgOdlRu3y1WUnB+wDRngxYe9GY1kTBYF0IRJCTM+laumOKmjlUPakEUpD2VLBx3o6ygqmV2GhsDZq8vbwdRNbVGfTEXIZpMKtTYJ/MenOhNZtvtVISCrPMXT7CLoGa53mBniIjswo2B6vBxafVfZjb6iRRbhJTf/hUAZc6eycbKjjMa9xjuz+c3QoD+aTmIGXKI/XaZOKukz4dhC+g7CIEHsGFWFTiZzzhkmvyG2HcqGRHQ2rGN6Z0hskQOxrNMiGUnbOpsZgb0P vamshi@vamshi-linux
@vamshi9666
vamshi9666 / get-components-occurence.js
Created May 17, 2022 02:23
get components summary
const sourceCodeDir = "./pages";
const fs = require("fs");
const path = require("path");
const getAllFiles = function (dirPath, arrayOfFiles) {
files = fs.readdirSync(dirPath);
arrayOfFiles = arrayOfFiles || [];
files.forEach(function (file) {
// jscodeshift can take a parser, like "babel", "babylon", "flow", "ts", or "tsx"
// Read more: https://github.com/facebook/jscodeshift#parser
export const parser = "tsx";
const allStyleProps = ["bg", "margin", "lineHeight", "padding", "fontWeight"];
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
const techstackItems = [
"JavaScript",
"TypeScript",
"Nodejs",
"Nextjs",
"Wordpress",
"React",
"ES6+",
"Angular",
"Angularjs",
import { useState } from "react";
import logo from "./logo.svg";
import "./App.css";
function App() {
return (
<div className="App">
<div
style={{
// width: "200px",