Skip to content

Instantly share code, notes, and snippets.

View yleflour's full-sized avatar

Yann Leflour yleflour

View GitHub Profile
import React, { useContext } from "react";
import { createContext } from "react";
export const contextFactory = <TParams, TStore>(useStore: (args: TParams) => TStore) => {
const Context = createContext<TStore>(null as TStore);
const useStoreContext = () => useContext(Context);
const Provider = (
props:
@yleflour
yleflour / callback-promises-async.ts
Created February 7, 2022 09:09
Callback / Promises / Async
// Callback
const asyncPowWithCallback = (arg1, timeout, callback: (error, value) => void) => {
setTimeout(() => {
callback(null, arg1*arg1);
}, timeout);
}
const value = asyncPowWithCallback(2, 100, (error, value) => {
console.log("value1");
});
diff --git a/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js b/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js
index 43fb09e..b62e654 100644
--- a/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js
+++ b/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js
@@ -145,10 +145,11 @@ var OneToManySubjectBuilder = /** @class */ (function () {
parentSubject: subject,
canBeUpdated: true,
identifier: removedRelatedEntityRelationId,
- changeMaps: [{
- relation: relation.inverseRelation,
@yleflour
yleflour / machine.js
Last active August 5, 2020 19:12
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@yleflour
yleflour / machine.js
Last active April 23, 2020 21:35
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@yleflour
yleflour / machine.js
Created March 30, 2020 15:51
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@yleflour
yleflour / LoopbackApp.ts
Created March 25, 2019 16:33
Singleton Pattern
class LoopbackApp {
private static instance: Promise<any>;
private constructor() {}
public static get app(): Promise<any> {
if (LoopbackApp.instance) return LoopbackApp.instance;
LoopbackApp.instance = new Promise((resolve, reject) => {
resolve();
import React from 'react';
import { Image, Text, View } from 'react-native';
function renderImage(node: any, output: any, state: any, styles: any) {
const { imageWrapper: wrapperStyle, image: imageStyle } = styles;
/**
* Prevent Native crash (View in Text) from occuring
*/
if (state.inline) {
// @flow
import React, { PureComponent } from 'react';
import { View, StyleSheet } from 'react-native';
import { VictoryChart, VictoryArea, VictoryAxis, VictoryScatter } from 'victory-native';
import { BackendTimestampConverter } from 'homefriend/src/services';
import appStyle from 'homefriend/src/appStyle';
type PropsType = {
consumptionHistory: DayConsumptionBackendDataType[],
import React from 'react';
import 'react-native';
import { shallow } from 'enzyme';
import { shallowToJson } from 'enzyme-to-json';
import LargeButton from '../LargeButton';
jest.mock('Materniteam/src/components/FadeIn.js');
describe('<LargeButton />', () => {