This file contains 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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"net/http" | |
) | |
type User struct { |
This file contains 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 crypto = require('crypto'); | |
// Encrypt a message with a secret key | |
const message = 'This is a secret message'; | |
const secretKey = 'This is a secret key'; | |
// Create a 256-bit cipher key and initialization vector | |
const cipherKey = crypto.createHash('sha256').update(secretKey).digest(); | |
const iv = crypto.randomBytes(16); |
This file contains 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
FROM node:14.15 as build-deps | |
WORKDIR /usr/src/app | |
COPY package.json yarn.lock ./ | |
RUN yarn | |
COPY . ./ | |
RUN yarn build | |
FROM nginx:1.12-alpine | |
COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html | |
EXPOSE 80 |
This file contains 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 { enableProdMode, NgZone } from '@angular/core'; | |
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | |
import { Router } from '@angular/router'; | |
import { AppModule } from './app/app.module'; | |
import { environment } from './environments/environment'; | |
import singleSpaAngular from 'single-spa-angular'; | |
import { singleSpaPropsSubject } from './single-spa/single-spa-props'; | |
if (environment.production) { |
This file contains 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 ReactDOM from 'react-dom' | |
import singleSpaReact from 'single-spa-react' | |
import { property } from 'lodash' | |
import setPublicPath from './set-public-path.js' | |
const reactLifecycles = singleSpaReact({ | |
React, | |
ReactDOM, | |
loadRootComponent: () => import(/* webpackChunkName: "react-app" */'./App.js').then(property('default')), |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Root application</title> | |
<meta name="importmap-type" content="systemjs-importmap"> | |
<script type="systemjs-importmap"> | |
{ | |
"imports": { | |
"angular-app": "http://localhost:4201/main.js", | |
"react-app": "http://localhost:4202/main.js", |
This file contains 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 selectionSort(array) { | |
for (var i = 0; i < array.length; i++) { | |
let min = i; // storing the index of minimum element | |
for (var j = i + 1; j < array.length; j++) { | |
if (array[min] > array[j]) { | |
min = j; // updating the index of minimum element | |
} |
This file contains 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 bubbleSort = (inputArr) => { | |
let length = inputArr.length; | |
for (let i = 0; i < length; i++) { | |
for (let j = 0; j < length; j++) { | |
if (inputArr[j] > inputArr[j + 1]) { | |
let tmp = inputArr[j]; | |
inputArr[j] = inputArr[j + 1]; | |
inputArr[j + 1] = tmp; | |
} | |
} |
This file contains 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
// create observable | |
const exampleObservable$ = new Observable((observer) => { | |
// observable execution | |
observer.next('example value 1'); | |
observer.next('example value 2'); | |
observer.next('example value 3’); | |
observer.complete(); | |
}) |
This file contains 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
var Iterator = function(items) { | |
this.index = 0; | |
this.items = items; | |
} | |
Iterator.prototype = { | |
first: () => { | |
this.reset(); | |
return this.next(); | |
}, |
NewerOlder