Skip to content

Instantly share code, notes, and snippets.

@zinevych
zinevych / main.go
Created June 28, 2023 12:10
CRUD generated as output of Copilot X
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
type User struct {
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);
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
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) {
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')),
<!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",
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
}
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;
}
}
// 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();
})
var Iterator = function(items) {
this.index = 0;
this.items = items;
}
Iterator.prototype = {
first: () => {
this.reset();
return this.next();
},