This is an article from mini-series of How you should not write code. If you know how to write code and want to write better code. Please follow someone like Robert Martin.
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
class Enum { | |
constructor(args, startIndex = 0, defaultValue) { | |
const em = args.split("|").reduce((m, key, index) => { | |
m[(m[key] = index + startIndex)] = key; | |
return m; | |
}, {}); | |
em.value = em.key = (k) => em[k]; | |
return new Proxy(em, { | |
get: (obj, prop) => (prop in obj ? obj[prop] : defaultValue), | |
set: (obj, prop, value) => { |
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
{ | |
"id": 1, | |
"version": "1.0.1", | |
"contributors": [ | |
"deepak", | |
"gary" | |
], | |
"actor": { | |
"name": "Tom Cruise", | |
"age": 56, |
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 evalReg = /(\.)|(\[(\d)\])/; | |
const safeEval = (key: string, obj: any) => { | |
let lastKey; | |
let match; | |
do { | |
if (lastKey) { | |
if (match && match[2]) { | |
obj = obj[lastKey][match[3]]; | |
} else { | |
obj = obj[lastKey]; |
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
Serial Number | Company Name | Employee Markme | Description | Leave | |
---|---|---|---|---|---|
9788189999599 | TALES OF SHIVA | Mark | mark | 0 | |
9780099578079 | 1Q84 THE COMPLETE TRILOGY | HARUKI MURAKAMI | Mark | 0 | |
9780198082897 | MY KUMAN | Mark | Mark | 0 | |
9780007880331 | THE GOD OF SMAAL THINGS | ARUNDHATI ROY | 4TH HARPER COLLINS | 2 | |
9780545060455 | THE BLACK CIRCLE | Mark | 4TH HARPER COLLINS | 0 | |
9788126525072 | THE THREE LAWS OF PERFORMANCE | Mark | 4TH HARPER COLLINS | 0 | |
9789381626610 | CHAMarkKYA MANTRA | Mark | 4TH HARPER COLLINS | 0 | |
9788184513523 | 59.FLAGS | Mark | 4TH HARPER COLLINS | 0 | |
9780743234801 | THE POWER OF POSITIVE THINKING FROM | Mark | A & A PUBLISHER | 0 |
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 moment from "https://cdn.pika.dev/moment@^2.26.0"; | |
export function greet(name: string) { | |
return `Hello, Mr./Ms. ${name}`; | |
} | |
export function formattedDate() { | |
const todayMoment = moment(new Date()); | |
const todayFormatted = todayMoment.format("MM/DD/YYYY hh:mm a"); | |
return todayFormatted; | |
} | |
formattedDate() |
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
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. | |
// This is a specialised implementation of a System module loader. | |
"use strict"; | |
// @ts-nocheck | |
/* eslint-disable */ | |
let System, __instantiate; | |
(() => { |
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
[ | |
{ | |
"title": "Easy To Say", | |
"href": "https://www.instagram.com/p/B0_guFApVon/", | |
"body": "It’s always easy to say,\nI do nothing, It’s my job.\nIt’s always easy to say,\nI do nothing, Just earn money to spend on.\nIt’s always easy for you,\nTo break my faith and courage that I make.\nYes, I am Man. Carrying all the pain, still smiling.\nYes, This is my job.\nIt’s always easy to say,\nYou carry my child and raise for so long.\nI did nothing, just gave a name and that’s all.\nIt’s always easy for you to say,\nYou make a living place home.\nYes, I know you do lot of things,\nThat why I try keep all my pain away so you can focus more.\nI do all dirty fight for you, so that you and our love ones can live more.\nYes you can say, I give just a name.\nBut I want people think before they try to harm you more.\nYes, I am Man. I don’t know.\nHow to say, It’s not easy to say I care, I care a lot.||" | |
}, | |
{ | |
"title": "Lady in the dark", | |
"href": "https://www.instagram.com/p/B7FHYKaJ6dR/", |
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
// app/index.js | |
const fastify = require("fastify")({ logger: false }); | |
// Take port from env variable | |
const PORT = process.env.PORT || 3000; | |
// Create user database | |
const users = Array(100) | |
.fill(0) | |
.map((_, x) => ({ | |
name: `User_${x}`, | |
id: `ID_${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
# Forget about JMeter, Start writing K6 scripts for Load Testing and Performance Monitoring | |
Performance testing or monitoring is not new to us. Whenever we create an API, We do need testing. For code and components, We write unit tests and integration tests. However, for performance, We need to load test and monitor the result. | |
A Gist page for article: [Forget about JMeter, Start writing K6 scripts for Load Testing and Performance Monitoring](https://medium.com/@deepak-v/writing-k6-scripts-for-load-testing-and-performance-monitoring-25cb2aefa23c) |