This file contains hidden or 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 deepFlatten(arr){ | |
return [].concat.apply([], arr.map(x => Array.isArray(x) ? deepFlatten(x) : x)); | |
} |
This file contains hidden or 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
/** | |
* Sets a delay for 'wait' milliseconds | |
* @param {Number} wait - wait time in milliseconds | |
*/ | |
let delay = async (wait) => { | |
console.log(`Waiting for ${wait} milliseconds`); | |
return new Promise(p => setTimeout(p, wait)); | |
} |
This file contains hidden or 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
export class AppComponent { | |
title = 'ui'; | |
keys = { | |
space : false, | |
ctrl : false | |
} | |
@HostListener('window:keydown', ['$event']) | |
keyEventDown(event: KeyboardEvent) { | |
if(event.keyCode === 17){ |
This file contains hidden or 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
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class AuthService { | |
httpClient : HttpClient; | |
constructor(httpClient : HttpClient) { | |
this.httpClient = httpClient; |
This file contains hidden or 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 express = require('express'); | |
const app = new express(); | |
// url requests. GET/POST | |
app.use(express.json()); | |
app.use(express.urlencoded()); | |
app.use(express.static(__dirname + "/public")); | |
// routing. |
This file contains hidden or 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
import React from 'react'; | |
import * as d3 from 'd3'; | |
export const PieChart = (props) => { | |
const chart = React.useRef(); | |
const { width, height, margin, chartData, title } = props; | |
// init all d3-chart related data here. | |
const renderChart = () => { |
This file contains hidden or 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 toKebabCase = str => | |
str && | |
str | |
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) | |
.map(x => x.toLowerCase()) | |
.join('-'); |
This file contains hidden or 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 fs = require('fs'); | |
const path = require('path'); | |
const HOME_PATH = "/Users/senthilmpro/Desktop/test"; | |
const HOME_FOLDER = path.resolve(HOME_PATH); | |
const files = fs.readdirSync(HOME_FOLDER, 'utf-8'); | |
console.log(files); |
This file contains hidden or 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 fs = require('fs'); | |
const path = require('path'); | |
// settings. | |
const CONF = { | |
HOME_PATH : "/Volumes/SYMC/movies/2-hindi/2-hindi-hevc" | |
} |
This file contains hidden or 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 renameFile = (folderPath, strToRemove) => { | |
const fs = require('fs'); | |
const path = require('path'); | |
const files = fs.readdirSync(folderPath,'utf-8'); | |
files.forEach(v => { | |
if(v.indexOf(strToRemove) !== -1){ | |
let newName = v.replace(strToRemove, ""); |