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
class MetaGroupList extends Component { | |
getGroupsFromFields = () => { | |
const { fields } = this.props; | |
return fields.map((fieldName, i) => { | |
return { ...fields.get(i), fieldName }; | |
}); | |
}; | |
destroyGroup = fieldName => { | |
if (window.confirm("Are you sure you'd like to delete this?")) { |
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
# Our code should do the following things: | |
# Make a list of numbers from 1 to 100, inclusive | |
# For each number, perform the following tests on it: | |
# FIZZ | |
# If the number is divisible by 3, output 'Fizz' | |
# BUZZ |
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
body { | |
background: #f9f9f9; | |
font-family: 'Open Sans', sans-serif; | |
text-align: center; | |
} | |
#container { | |
position: relative; | |
z-index: 2; | |
padding-top: 100px; |
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, { Component } from 'react' | |
import './App.css' | |
import ActionCable from 'actioncable' | |
class App extends Component { | |
state = { text: '' } | |
componentDidMount() { | |
window.fetch('http://localhost:3001/notes/1').then(data => { | |
data.json().then(res => { |
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
class NotesChannel < ApplicationCable::Channel | |
def subscribed | |
# stream_from "some_channel" | |
stream_from 'notes' | |
end | |
def unsubscribed | |
# Any cleanup needed when channel is unsubscribed | |
end |
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, { Component } from 'react' | |
import './App.css' | |
class App extends Component { | |
state = { text: '' } | |
componentDidMount() { | |
window.fetch('http://localhost:3001/notes/1').then(data => { | |
data.json().then(res => { | |
this.setState({ text: res.text }) |
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 { Provider } from 'mobx-react' | |
// Importing our own stores | |
import { UserStore, ContactStore } from '../stores' | |
const state = { | |
userStore: UserStore, | |
contactStore: ContactStore | |
} |
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 { toJS, observable } from 'mobx' | |
class Contact { | |
id = 0 | |
@observable name = '' | |
@observable number = '' | |
constructor(data) { | |
this.name = data.name | |
this.number = data.number |
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 { observable } from 'mobx' | |
class ContactStore { | |
@observable contacts = [] | |
load() { | |
fetch(API_URL + '/contacts') | |
.then(data => { | |
const list = data.contacts.map(contactData => { | |
return new Contact(contactData) |
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
body { | |
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; | |
} | |
#root { | |
background-color: #f5f8fa; | |
height: 100%; | |
min-height: 100vh; | |
padding: 20px 0; | |
} |