Skip to content

Instantly share code, notes, and snippets.

View mfrachet's full-sized avatar
💭
😊

Marvin Frachet mfrachet

💭
😊
View GitHub Profile
@mfrachet
mfrachet / react-cache-promise.js
Created January 11, 2019 13:00
react-cache-promise
setTimeout(() => console.log('Callback called') , 0);
Promise.resolve().then(() => console.log('Promise resolved'));
@mfrachet
mfrachet / react-cache.jsx
Created January 11, 2019 12:58
React cache
const getBulbasaur = () =>
fetch("https://pokeapi.co/api/v2/pokemon/1/").then(res => res.json());
const ApiResource = createResource(getBulbasaur);
const Pokemon = () => {
const bulbasaur = ApiResource.read();
return <div>Hello {bulbasaur.name}</div>;
};
const fs = require('fs');
const data = fs.readFileSync('/file.md');
console.log("Hey guys");
@mfrachet
mfrachet / bd3d4befe38185704bf0fc875e9deed6|configuration.json
Last active January 18, 2022 16:17
Visual Studio Code Settings Sync Gist
{"contents":{"launch":{"version":"0.2.0","configurations":[{"type":"node","request":"attach","name":"Docker: Attach to Node","port":5000,"address":"localhost","localRoot":"${workspaceFolder}","remoteRoot":"/Users/fpensato/Projects/site-6play-v4","protocol":"auto"},{"type":"node","request":"attach","name":"Attach by Process ID","processId":"${command:PickProcess}","protocol":"auto"}]}},"overrides":[],"keys":["launch.version","launch.configurations"]}
@mfrachet
mfrachet / rep.js
Last active February 5, 2018 07:00
reparentable.js2
<View style={styles.container}>
<Reparentable name="fullscreenView" target="">
<FullScreenContainer />
</Reparentable>
<Reparentable
name="videoPlayerId"
target={this.state.isFullscreen ? "fullscreenView" : ""}
>
<VideoPlayer />
@mfrachet
mfrachet / reparentable.js
Created February 2, 2018 09:34
reparentable.js
<View style={styles.container}>
<Reparentable name="1" target="">
<Text>First</Text>
</Reparentable>
<Reparentable name="2" target={this.state.shouldGo ? "1" : "goNowhere"}>
<Text>Second</Text>
</Reparentable>
</View>
@mfrachet
mfrachet / uimanager.js
Last active February 2, 2018 09:14
uimanager.js
componentDidMount() {
setTimeout(() => {
// Permute child at indice 0 and 1 of parent tag 6
UIManager.manageChildren(6, [0], [1], [], [], []);
}, 3000);
}
const AlterNativeView = ({ isDisplayed }) => (
<View>
<Text>Hello</Text>
<Text style={{ display: isDisplayed ? "flex" : "none" }}>World</Text>
</View>
);
@mfrachet
mfrachet / hello-world-state.js
Last active September 26, 2017 10:17
RN Eu
const AlterNativeView = ({ isDisplayed }) => (
<View>
<Text>Hello</Text>
{isDisplayed && <Text>World</Text>}
</View>
);
@mfrachet
mfrachet / hello-world.js
Created September 21, 2017 10:14
RN Eu
<View style={style.blue}>
<Text>Hello world !</Text>
</View>