Skip to content

Instantly share code, notes, and snippets.

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?")) {
# 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
@scottdomes
scottdomes / app.css
Created September 18, 2017 21:35
React Audio Tutorial
body {
background: #f9f9f9;
font-family: 'Open Sans', sans-serif;
text-align: center;
}
#container {
position: relative;
z-index: 2;
padding-top: 100px;
@scottdomes
scottdomes / App.js
Last active May 22, 2018 13:22
docs-clone-final
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 => {
class NotesChannel < ApplicationCable::Channel
def subscribed
# stream_from "some_channel"
stream_from 'notes'
end
def unsubscribed
# Any cleanup needed when channel is unsubscribed
end
@scottdomes
scottdomes / App.js
Created July 26, 2017 23:02
docs-clone
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 })
import React from 'react'
import { Provider } from 'mobx-react'
// Importing our own stores
import { UserStore, ContactStore } from '../stores'
const state = {
userStore: UserStore,
contactStore: ContactStore
}
import { toJS, observable } from 'mobx'
class Contact {
id = 0
@observable name = ''
@observable number = ''
constructor(data) {
this.name = data.name
this.number = data.number
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)
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
#root {
background-color: #f5f8fa;
height: 100%;
min-height: 100vh;
padding: 20px 0;
}