Skip to content

Instantly share code, notes, and snippets.

View MicheleBertoli's full-sized avatar
🏖️
I'm taking a break from OSS.

Michele Bertoli MicheleBertoli

🏖️
I'm taking a break from OSS.
View GitHub Profile
@MicheleBertoli
MicheleBertoli / app.js
Created February 19, 2016 15:47
React Repeat
const App = React.createClass({
render() {
return (
<Repeat collection={[1, 2]}>
{item => <div>{item}</div>}
</Repeat>
);
}
});
@MicheleBertoli
MicheleBertoli / demo.js
Last active February 2, 2021 09:21
Multiple Info Windows
import React from 'react';
import ReactDOM from 'react-dom';
import {Gmaps, Marker, InfoWindow} from 'react-gmaps';
const points = [{
lat: 51.5258541,
lng: -0.09040660000006028
}, {
lat: 51.5258541,
lng: -0.08040660000006028
@MicheleBertoli
MicheleBertoli / index.spec.js
Created September 8, 2018 10:40
Styled Component v4
import React from 'react'
import styled from 'styled-components'
import renderer from 'react-test-renderer'
import { shallow, mount } from 'enzyme'
import { render } from 'react-testing-library'
const Button = styled.button`
color: red;
`
@MicheleBertoli
MicheleBertoli / App.jsx
Last active August 30, 2018 13:12
React Automata
import React from 'react'
import { Action, withStatechart } from 'react-automata'
const statechart = {
initial: 'idle',
states: {
idle: {
on: {
FETCH: 'fetching',
},
@MicheleBertoli
MicheleBertoli / demo.js
Created August 31, 2016 10:49
Erdux - Unpredictable state container for JavaScript apps
class DecrementAction extends Error {}
class IncrementAction extends Error {}
const reducer = (state, error) => {
switch (error.constructor) {
case DecrementAction:
return state - 1
case IncrementAction:
return state + 1
@MicheleBertoli
MicheleBertoli / toBeShallowInstanceOf.spec.js
Created October 10, 2017 19:48
toBeShallowInstanceOf
expect.extend({
toBeShallowInstanceOf(received, argument) {
const pass = Object.getPrototypeOf(received) === argument.prototype
return {
message: () => (pass ? 'OK' : 'KO'),
pass,
}
},
})
@MicheleBertoli
MicheleBertoli / demo.js
Created September 5, 2017 20:37
InfoWindow
const coords = {
lat: 51.5258541,
lng: -0.08040660000006028,
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
@MicheleBertoli
MicheleBertoli / README.md
Created July 16, 2017 10:23
Tested with Jest

tested with jest

@MicheleBertoli
MicheleBertoli / demo.js
Created August 12, 2016 10:47
Gmaps setIcon
import React from 'react';
import ReactDOM from 'react-dom';
import { Gmaps, Marker } from 'react-gmaps';
const coords = {
lat: 51.5258541,
lng: -0.08040660000006028
};
const beach = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
@MicheleBertoli
MicheleBertoli / demo.js
Created May 7, 2016 06:52
Gmaps pan to
import React from 'react';
import ReactDOM from 'react-dom';
import {Gmaps, Marker, InfoWindow} from 'react-gmaps';
const points = [{
lat: 51.5258541,
lng: -0.09040660000006028
}, {
lat: 51.5258541,
lng: -0.08040660000006028