Eve Porcello
@eveporcello
eve@moonhighway.com
Start: 7:00am
Break: 7:45am
End: 9:30am
This is a little weird.
Make it your own.
Take what is useful.
FROM
TO
FROM
TO
FROM
TO
FROM
TO
Have a point of view
Use alliteration
Make it sensational!
Who's the jock? The nerd? The misfit? Who's the type A overachiever, or the moody artist, or the partier?
Get to know each of these JavaScript frameworks through the hallowed medium of the teen comedy.
In this talk, we'll dig into what makes these frameworks unique, and as in every good millennial teen movie, you'll leave with a better understanding of each one.
Use your own topic or enhance this abstract with specifics.
Have you ever wanted to learn Node.js? In this talk, we'll dig deeper into Node.js. You can expect to walk away knowing Node.js.
40 mins
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
const allUsers = await prisma.user.findMany({
include: { posts: true },
})
console.log(allUsers)
}
main()
.finally(async () => {
await prisma.$disconnect()
})
import React, { Component } from 'react'
import { storage } from '../../client'
import { PLAYER_ROOT_QUERY, LISTEN_FOR_INSTRUCTIONS, LOGOUT } from '.'
import { WaitingForInstructions } from './ui/WaitingForInstructions'
import { End } from './ui/End'
import { Team } from './Team'
import { Game } from './Game'
export class CurrentPlayer extends Component {
logout = () => {
this.props.client.mutate({ mutation: LOGOUT })
storage.removeItem('token')
this.props.client.writeQuery({
query: PLAYER_ROOT_QUERY,
data: {
me: null
}
})
}
componentDidMount() {
this.stopListeningToInstructions = this.props.client
.subscribe({ query: LISTEN_FOR_INSTRUCTIONS })
.subscribe(({ data, error }) => {
if (error) {
return console.error(error)
}
console.log('new instructions: ', data.instructions.endEvent)
this.props.client.writeQuery({
query: PLAYER_ROOT_QUERY,
data: {
me: data.instructions
}
})
})
}
componentWillUnmount() {
if (this.stopListeningToInstructions) {
this.stopListeningToInstructions._cleanup()
}
}
render() {
const { avatar, name, login, team, playingGame, instrument, endEvent } = this.props
return playingGame ?
<Game instrument={instrument} /> :
team ?
<Team {...team}
avatar={avatar}
onLeave={this.logOut} /> :
endEvent ?
<End /> :
<WaitingForInstructions
name={name || login}
avatar={avatar}
onLeave={this.logout} />
}
}
import React from 'react'
import { ExitButton } from './ExitButton'
import styled from 'styled-components'
export const WaitingForInstructions = ({ name, avatar, onLeave=f=>f }) =>
<Container>
<figure>
<img src={avatar} width={48} height={48} alt="" />
</figure>
<h1>
<span>Welcome,</span>
<span>{name}</span>
</h1>
<ExitButton onClick={onLeave} />
</Container>
export class Wejay extends Component {
state = { loadingMusic: true }
async componentDidMount() {
const files = [bass,drums,percussion,sampler,synth]
const tracks = await loadAllAudio(files)
tracks.forEach(track => {
track.volume = 0
track.loop = true
})
tracks.forEach(track => track.play())
let [BASS,DRUMS,PERCUSSION,SAMPLER,SYNTH] = tracks
this.tracks = {BASS,DRUMS,PERCUSSION,SAMPLER,SYNTH}
this.setState({ loadingMusic: false })
}
componentWillUnmount = () => {
Object.keys(this.tracks).forEach(instrument => this.tracks[instrument].src = '')
}
instruments = data =>
data.gameChange.playingMusic.map(({ instrument }) => instrument)
isPlayingMusic = (data, instrument) => data &&
-1 !== this.instruments(data).indexOf(instrument)
playTrack = data => {
if (data) {
this.playSound(this.instruments(data))
}
}
playSound = instruments =>
Object.keys(this.tracks).forEach(key =>
this.tracks[key].volume = instruments.indexOf(key) !== -1 ? 1 : 0
)
render() {
const { players } = this.props
const { loadingMusic } = this.state
return loadingMusic ?
<LoadingScreen /> :
<Subscription subscription={LISTEN_FOR_GAME_CHANGES}>
{({ data }) => {
this.playTrack(data)
return (
<Container>
{(data && data.gameChange.faces.length) ?
<Audience faces={data.gameChange.faces} /> :
null
}
{players.map(p =>
<Musician key={p.login}
avatar={p.avatar}
login={p.login}
instrument={p.instrument}
playingMusic={this.isPlayingMusic(data, p.instrument)}/>
)}
</Container>
)
}}
</Subscription>
}
}
export class Wejay extends Component {
state = { loadingMusic: true }
async componentDidMount() {
const files = [bass,drums,percussion,sampler,synth]
const tracks = await loadAllAudio(files)
tracks.forEach(track => {
track.volume = 0
track.loop = true
})
tracks.forEach(track => track.play())
let [BASS,DRUMS,PERCUSSION,SAMPLER,SYNTH] = tracks
this.tracks = {BASS,DRUMS,PERCUSSION,SAMPLER,SYNTH}
this.setState({ loadingMusic: false })
}
componentWillUnmount = () => {
Object.keys(this.tracks).forEach(instrument => this.tracks[instrument].src = '')
}
instruments = data =>
data.gameChange.playingMusic.map(({ instrument }) => instrument)
isPlayingMusic = (data, instrument) => data &&
-1 !== this.instruments(data).indexOf(instrument)
playTrack = data => {
if (data) {
this.playSound(this.instruments(data))
}
}
playSound = instruments =>
Object.keys(this.tracks).forEach(key =>
this.tracks[key].volume = instruments.indexOf(key) !== -1 ? 1 : 0
)
render() {
const { players } = this.props
const { loadingMusic } = this.state
return loadingMusic ?
<LoadingScreen /> :
<Subscription subscription={LISTEN_FOR_GAME_CHANGES}>
{({ data }) => {
this.playTrack(data)
return (
<Container>
{players.map(p =>
<Musician key={p.login}
avatar={p.avatar}
login={p.login}
instrument={p.instrument}
playingMusic={this.isPlayingMusic(data, p.instrument)}/>
)}
</Container>
)
}}
</Subscription>
}
}
import React, { Component } from 'react'
import { random } from 'faker'
import styled from 'styled-components'
export class ConnectedPlayer extends Component {
bounds = {
height: window.innerHeight,
width: window.innerWidth
}
constructor(props) {
super()
let top, left
switch(Math.floor(Math.random()*8)) {
case 0:
top = `${random.number({ min: 0, max: this.bounds.height * .25 })}px`
left = `${random.number({ min: 0, max: this.bounds.width * .25 })}px`
break
case 1:
top = `${random.number({ min: 0, max: this.bounds.height * .25 })}px`
left = `${random.number({ min: this.bounds.width * .25, max: this.bounds.width * .75 })}px`
break
case 2:
top = `${random.number({ min: 0, max: this.bounds.height * .25 })}px`
left = `${random.number({ min: (this.bounds.width * .75)-100, max: this.bounds.width-60 })}px`
break
case 3:
top = `${random.number({ min: this.bounds.height * .25, max: this.bounds.height * .75 })}px`
left = `${random.number({ min: 0, max: this.bounds.width * .25 })}px`
break
case 4:
top = `${random.number({ min: this.bounds.height * .25, max: this.bounds.height * .75 })}px`
left = `${random.number({ min: (this.bounds.width * .75)-100, max: this.bounds.width-60 })}px`
break
case 5:
top = `${random.number({ min: this.bounds.height * .75, max: this.bounds.height-60 })}px`
left = `${random.number({ min: 0, max: this.bounds.width * .25 })}px`
break
case 6:
top = `${random.number({ min: this.bounds.height * .75, max: this.bounds.height-60 })}px`
left = `${random.number({ min: this.bounds.width * .25, max: this.bounds.width * .75 })}px`
break
default:
top = `${random.number({ min: this.bounds.height * .75, max: this.bounds.height-60 })}px`
left = `${random.number({ min: (this.bounds.width * .75)-100, max: this.bounds.width-60 })}px`
break
}
this.state = { top, left }
}
render() {
const { avatar, login, team } = this.props
const { top, left } = this.state
return (
<Container teamColor={team && team.color.name} top={top} left={left}>
<img src={avatar} alt={login} />
</Container>
)
}
}
const Container = styled.div`
position: fixed;
top: ${props => props.top};
left: ${props => props.left};
img {
width: 60px;
height: 60px;
border-radius: 50%;
border: solid 5px ${props => props.teamColor ? props.teamColor : props.theme.colors.contrast};
}
`
Treat yourself accordingly!