This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { | |
sub: { | |
array: [1,2,3,4,5,6,7,8,9] | |
}, | |
*[Symbol.iterator]() { | |
for (let i = 0; i < this.sub.length; i++) { | |
yield this.sub[i]; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { | |
sub: { | |
array: [] | |
}, | |
[Symbol.iterator]() { | |
let index = 0; | |
return { | |
next: () => { | |
// you could insert custom logic here, like stepping 3 by 3, filtering, etc. | |
if ( index >= this.sub.array.length ) return { done: true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<style type="text/css"> | |
.container { | |
width: 300px; | |
height: 200px; | |
display: flex; | |
/* put the undesirable elements on a second column */ | |
flex-flow: column wrap; | |
/* hide that second column */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Story, Meta } from '@storybook/react/types-6-0'; | |
import { Provider } from 'react-redux'; | |
import addons from '@storybook/addons'; | |
import withRedux from 'addon-redux/withRedux'; | |
import { MyComponent } from '../components/MyComponent/MyComponent'; | |
import store from '../store'; | |
import { RootState } from '../types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH="/Users/jean-marieporchet/.oh-my-zsh" | |
# Set name of the theme to load --- if set to "random", it will | |
# load a random theme each time oh-my-zsh is loaded, in which case, | |
# to know which specific one was loaded, run: echo $RANDOM_THEME | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { takeEvery, call, put, all, select } from 'redux-saga/effects'; | |
import * as ActionTypes from '../actions'; | |
import { networkService } from '../services/networkService'; | |
export function* getAutocompleteInfo(action) { | |
const token = yield select(state => state.user.token); | |
const autocompleteSuggestions = yield call( | |
networkService.requestAutocompleteInfo, | |
action.query, | |
token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is an illustration of when NOT to use the spread operator to copy variables. | |
// Check https://codesandbox.io/s/6w749171mz for a working copy of the code | |
import { cloneDeep } from "lodash"; | |
import { | |
getDrinkNutrientsFromResult, | |
mapRecipesToNutrients | |
} from "../nutrition"; | |
describe("helper methods", () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { render, fireEvent } from 'react-native-testing-library'; | |
import { _EditPlanDetails as EditPlanDetails } from '../Settings/EditPlanDetails'; | |
// Scrollviews are bugged in the current Expo/RN release and won't render in tests https://github.com/expo/expo/issues/2806#issuecomment-465373231 | |
jest.mock('ScrollView', () => require.requireMock('ScrollViewMock')); | |
describe('EditPlanDetails', () => { | |
const props = { | |
subscription: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AsyncStorage } from 'react-native'; | |
class AsyncStorageService { | |
static async get(key) { | |
const data = await AsyncStorage.getItem(key); | |
return JSON.parse(data); | |
} | |
static set(key, value) { | |
return AsyncStorage.setItem(key, JSON.stringify(value)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-11-21T22:04:21.419Z","extensionVersion":"v3.4.3"} |
NewerOlder