This file contains hidden or 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
| web: MIX_ENV=prod mix ecto.migrate && mix.phoneix.server |
This file contains hidden or 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
| defmodule LearnPhoenix do | |
| use Application | |
| def start(_type, _args) do | |
| ... | |
| # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html | |
| # for other strategies and supported options | |
| opts = [strategy: :one_for_one, name: LearnPhoenix.Supervisor] | |
| start_result = Supervisor.start_link(children, opts) |
This file contains hidden or 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
| [ | |
| { | |
| "hex": "#EFDECD", | |
| "name": "Almond", | |
| "rgb": "(239, 222, 205)" | |
| }, | |
| { | |
| "hex": "#CD9575", | |
| "name": "Antique Brass", | |
| "rgb": "(205, 149, 117)" |
This file contains hidden or 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 calculate = (n, k) => { | |
| const exponent = (-k * (k - 1)) / (2 * n) | |
| return 1 - Math.E ** exponent | |
| } | |
| // where `n` is the number of possible unique hashes | |
| // where `k` is the number of values created | |
| // calculate(100000, 25) => 0.0029955044966269995 aka 0.29% chance of collision |
This file contains hidden or 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' | |
| let counter = 0 | |
| class App extends React.Component { | |
| constructor(props) { | |
| super(props) | |
| this.addOne = this.addOne.bind(this) | |
| } | |
This file contains hidden or 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 App extends React.Component { | |
| static requiredData = [ | |
| "username", | |
| "email", | |
| "thumbnail_url" | |
| ] | |
| render() { | |
| return(<div></div>) | |
| } |
This file contains hidden or 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 App extends React.Component { | |
| constructor() { | |
| super() | |
| this.prototypeProperty = { | |
| baz: "qux" | |
| } | |
| } | |
| static staticProperty = { | |
| foo: "bar" | |
| }; |
This file contains hidden or 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 App extends React.Component { | |
| static propTypes { | |
| title: React.PropTypes.string.isRequired | |
| } | |
| render() { | |
| return (<div>{ this.props.title }</div>) | |
| } | |
| } |
This file contains hidden or 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 App extends React.Component { | |
| render() { | |
| return (<div>{ this.props.title }</div>) | |
| } | |
| } | |
| App.propTypes = { | |
| title: React.PropTypes.string.isRequired | |
| } |
This file contains hidden or 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 { Socket } from 'phoenix' | |
| class App extends React.Component { | |
| componentDidMount() { | |
| this.socket = new Socket('http://localhost:4000/socket') | |
| this.socket.connect() | |
| this.configureChannel("lobby") | |
| } | |