Skip to content

Instantly share code, notes, and snippets.

View Kjaer's full-sized avatar
👷‍♂️
Code Janitor

Halil Kayer Kjaer

👷‍♂️
Code Janitor
View GitHub Profile

ARCH OVERVIEW

COMPONENTS

CENTER
  • has many clusters.
  • passes down the minimum and maximum server count
  • passes down available apps for the cluster

CLUSTER

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@Kjaer
Kjaer / package[final].json
Created October 15, 2019 08:11
"Setting up Jest and Enzyme for Typescript Next.js apps" post gists
{
"name": "our-cool-nextjs-app",
"version": "0.1.0",
"dependencies": {
"next": "^9.1.1",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"tslib": "^1.10.0"
},
"scripts": {
@Kjaer
Kjaer / setupTest[v1].js
Created October 15, 2019 08:18
"Setting up Jest and Enzyme for Typescript Next.js apps" post gists
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
// Configure Enzyme with React 16 adapter
Enzyme.configure({ adapter: new Adapter() });
@Kjaer
Kjaer / Button.spec.tsx
Last active October 15, 2019 10:19
"Setting up Jest and Enzyme for Typescript Next.js apps" post gists
import React from 'react';
import { mount } from 'enzyme';
test('hello world', () => {
 const wrapper = mount(<p>Hello Jest!</p>);
 expect(wrapper.text()).toMatch('Hello Jest!');
});
@Kjaer
Kjaer / jest.config[1].js
Last active October 15, 2019 15:22
"Setting up Jest and Enzyme for Typescript Next.js apps" post gists
module.exports = {
"testEnvironment": "node",
"roots": [
"<rootDir>/components"
],
"preset": "ts-jest",
"setupFilesAfterEnv": ["<rootDir>/tests/setupTests.ts"],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
@Kjaer
Kjaer / jest.config[2].js
Created October 15, 2019 15:22
"Setting up Jest and Enzyme for Typescript Next.js apps" post gists
module.exports = {
"testEnvironment": "node",
"roots": [
"<rootDir>/components"
],
"preset": 'ts-jest',
"setupFilesAfterEnv": ["<rootDir>/tests/setupTests.ts"],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
@Kjaer
Kjaer / tsconfig.jest.json
Last active October 15, 2019 15:28
"Setting up Jest and Enzyme for Typescript Next.js apps" post gists
{
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react"
}
}
@Kjaer
Kjaer / iteration_of_collections.js
Created January 30, 2020 11:39
Performance tips for O(n²) on JavaScript iterations.
function charUnique(s) {
var r = {},
i, x;
for (i = s.length - 1; i > -1; i--) {
x = s[i];
if (r[x])
return false;
r[x] = true;
}
return true;
@Kjaer
Kjaer / proxy.js
Created February 7, 2020 12:46 — forked from beradrian/proxy.js
CORS proxy with node-http-proxy
/** If you want to use the local development environment with the dev backend,
* this will create a proxy so you won't run into CORS issues.
* It accepts the following command line parameters:
* - port the port where the proxy will listen
* - target the DEV backend target to contact.
* Example: If you set the port to 3000 and target to https://dev.nibo.ai then
* your actual "resourceBaseUrl" in NiboSettings should be http://localhost:3000/api/v1
*/
// Define the command line options
const optionDefinitions = [