Skip to content

Instantly share code, notes, and snippets.

View georgesimos's full-sized avatar
🇬🇷
Working from Greece

George Simos georgesimos

🇬🇷
Working from Greece
View GitHub Profile

Interview Agenda

Introduction (5 minutes)

  • Briefly introduce yourself and your role.
  • Provide an overview of the company and the team.
  • Explain the structure of the interview.

Candidate Background (5 minutes)

@georgesimos
georgesimos / get_main.md
Last active January 29, 2021 15:26
Renaming the Local master Branch to main
# Switch to the "master" branch:
$ git checkout master

# Rename it to "main":
$ git branch -m master main

# Get the latest commits (and branches!) from the remote:
$ git fetch
import React, { useReducer } from "react";
export default (reducer, actions, initialState) => {
const Context = React.createContext(null);
// Context.displayName = "ContextName";
const Provider = ({ children }) => {
const [state, dispatch] = useReducer(reducer, initialState);
const boundActions = {};
for (let key in actions) {
@georgesimos
georgesimos / reorder.js
Created July 22, 2020 20:19
A little function to help us with reordering the result
const reorder = (list, startIndex, endIndex) => {
const result = [...list];
const [removed] = result.splice(startIndex, 1);
result.splice(endIndex, 0, removed);
return result;
};
const arrayToObj = components.reduce((acc, cur) => {
acc[cur.id] = cur;
return acc;
}, {});
import { Directive } from '@angular/core';
import { Validator, AbstractControl, NG_VALIDATORS } from '@angular/forms';
@Directive({
selector: '[afmValidate]',
providers: [
{
provide: NG_VALIDATORS,
useExisting: AfmValidateDirective,
multi: true,
@georgesimos
georgesimos / localstorage.md
Created May 31, 2020 16:13
local storage utils for setting, removing and getting values.

Write a key / value into localStorage with an expire time

export const setStorage = (key, value, expires) => {
  if (expires === undefined || expires === null) {
    expires = 24 * 60 * 60; // default: seconds for 1 day
  }

  const now = Date.now(); //millisecs since epoch time, lets deal only with integer
 const schedule = now + expires * 1000;
@georgesimos
georgesimos / NgRx_reducer.md
Last active May 31, 2020 16:14
NgRx Reducer Steps

01 Define the shape of your state

export interface YourState {
  array: Array[];
  string: string | null;
}

02 Define the initial state