Skip to content

Instantly share code, notes, and snippets.

View cypress-run-parallel-scripts.js
//We're running the npm-run-all package to run the scripts independently for TDD/BDD test cases without dockerization and can help in to CI pipelines without overhead of getting all the scripts running sequentially or serially.
//This will parallely execute all the test-scripts files
"app-one": "cypress open --env configFile=script-one.local.json, isCI=false --config video=false"
"app-two": "cypress open --env configFile=script-two.local.json, isCI=false --config video=false"
"app-three": "cypress open --env configFile=script-three.local.json, isCI=false --config video=false"
"run-all-scripts-parallel": "npm-run-all --parallel app-two app-three"
View kubectl-nginx deployment
533 minikube status
534 kubectl version
535 kubectl get nodes
536 kubectl api-resources
537 kubectl api-versions
538 clear
539 kubectl get pods
540 kubectl get deployments
541 kubectl run nginx --image=nginx
542 kubectl get pods
View cypress-dependent-dropdown.js
it.only('Cowin State Chooser', function () {
cy.intercept('GET', '**/location/districts/2').as('Location');
cy.visit('https://www.cowin.gov.in/home');
cy.xpath("//div[text()='Search by District']")
.scrollIntoView({ offset: { top: -200, left: 0 }, easing: 'linear', duration: 1000, })
.should('be.visible').click();
cy.xpath("//mat-select[@formcontrolname='state_id']//div[contains(@class,'mat-select-arrow-wrapper')]")
.should('be.visible').click();
View api-client0window.js
function client(endpoint, customConfig = {}) {
const config = {
method: 'GET',
...customConfig,
}
return window
.fetch(`${process.env.REACT_APP_API_URL}/${endpoint}`, config)
.then(async response => {
const data = await response.json()
View users.json
{
"_id" : ObjectId("5f9a940f9d32533a3dc9b2d6"),
"gender" : "male",
"name" : {
"first" : "john",
"last" : "doe"
},
"location" : {
"coordinates" : {
"latitude" : "-10.5930",
View .gitignore-reactjs
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
View student.json
{
"_id" : ObjectId("5f9a940f9d32533a3dc9b2d6"),
"gender" : "male",
"name" : {
"first" : "john",
"last" : "doe"
},
"location" : {
"coordinates" : {
"latitude" : "-10.5930",
View apollo_client.ts
import { ApolloClient, InMemoryCache } from "@apollo/client";
import { NextPageContext } from "next";
import React from "react";
import App from "next/app";
import Head from "next/head";
import { ApolloProvider } from "@apollo/client";
// On the client, we store the Apollo Client in the following variable.
View grades.json
{ "_id" : { "$oid" : "50b59cd75bed76f46522c34e" }, "student_id" : 0, "class_id" : 2, "scores" : [ { "type" : "exam", "score" : 57.92947112575566 }, { "type" : "quiz", "score" : 21.24542588206755 }, { "type" : "homework", "score" : 68.19567810587429 }, { "type" : "homework", "score" : 67.95019716560351 }, { "type" : "homework", "score" : 18.81037253352722 } ] }
{ "_id" : { "$oid" : "50b59cd75bed76f46522c34f" }, "student_id" : 0, "class_id" : 28, "scores" : [ { "type" : "exam", "score" : 39.17749400402234 }, { "type" : "quiz", "score" : 78.44172815491468 }, { "type" : "homework", "score" : 20.81782269075502 }, { "type" : "homework", "score" : 70.44520452408949 }, { "type" : "homework", "score" : 50.66616327819226 }, { "type" : "homework", "score" : 53.84983118363991 } ] }
{ "_id" : { "$oid" : "50b59cd75bed76f46522c350" }, "student_id" : 0, "class_id" : 5, "scores" : [ { "type" : "exam", "score" : 88.22950674232497 }, { "type" : "quiz", "score" : 79.28962650427184 }, { "type" : "homework", "score" : 18.662549465
View dockerfile-drupal2
ARG BASE_IMAGE_TAG=7.2-apache
FROM drupaldocker/php:${BASE_IMAGE_TAG}
# Install CLI dependencies
RUN apt-get update && apt-get install -y mariadb-client curl git vim \
&& apt-get clean
# Install Composer
RUN echo "allow_url_fopen = On" > /usr/local/etc/php/conf.d/drupal-01.ini
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin -- --filename=composer