Skip to content

Instantly share code, notes, and snippets.

View klauskpm's full-sized avatar
:shipit:
Making weird things useful

Klaus Kazlauskas klauskpm

:shipit:
Making weird things useful
  • Brasil
View GitHub Profile
@klauskpm
klauskpm / index.js
Created April 28, 2018 14:11
Example of a barrel export
export * from './src/components/foo';
export * from './src/components/bar';
export * from './src/components/foo-bar';
export const globalEnvironment = {
production: true,
title: 'Global production'
};
import { globalEnvironment } from '../../../../environments/environment.prod';
export const environment = {
production: false,
title: 'Main production',
...globalEnvironment
};
@klauskpm
klauskpm / strategies-injector-inject-environment.ts
Last active January 6, 2019 21:53
Environment injection strategy
import { InjectionToken } from '@angular/core';
export const ENVIRONMENT = new InjectionToken<any>('Environment injection token');
@klauskpm
klauskpm / simple-hook.js
Last active August 2, 2022 14:34
An example of how to create a hook, share a context and loop on state changes.
let contextCounter = 0;
let sharedContext = [];
let innitializedContext = [];
let wasContextUpdated = false;
function createContext(lifecycle) {
sharedContext = [];
innitializedContext = []
const loop = () => {
contextCounter = 0;