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' | |
let counter = 0 | |
class App extends React.Component { | |
constructor(props) { | |
super(props) | |
this.addOne = this.addOne.bind(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
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 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 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 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 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 makesModels = { | |
"Acura": { | |
"ILX": { | |
"years": [ | |
2016, | |
2015, | |
2014, | |
2013, | |
2012 | |
] |
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
const formatData = data => { | |
// We're sorting by alphabetically so we need the alphabet | |
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); | |
// Need somewhere to store our data | |
const dataBlob = {}; | |
const sectionIds = []; | |
const rowIds = []; | |
// Each section is going to represent a letter in the alphabet so we loop over the alphabet |
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
export const makes = { | |
"makes": [{ | |
"id": "279a091a-32c1-46c7-80d2-b3423320f18f", | |
"name": "AM General" | |
}, { | |
"id": "72cadfa6-e1c0-4507-9bdd-835f93951dd6", | |
"name": "Acura" | |
}, { | |
"id": "02a97e0d-eb73-48e3-898a-567a3c81c0ee", | |
"name": "Alfa Romeo" |
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 { View, Text, TouchableOpacity, } from 'react-native' | |
import style from './style' | |
const pipe = (fns, init) => fns.reduce((acc, fn) => fn(acc), init) | |
const monthLabels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] | |
const getDaysInMonth = (month, year) => { | |
if (month === 1) { |
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
"scripts": { | |
"start": "node server.js", | |
"cover": "nyc -x '**/*spec.js' -n 'app' -r text -r html -r lcov npm test", | |
"test": "mocha --compilers js:babel-register -r babel-polyfill -r whatwg-fetch -r jsdom-global/register -r .test-setup.js -R spec app/**/spec.js app/**/*spec.js app/redux/actions/*spec.js", | |
"test:watch": "npm test -- --watch", | |
"prodbuild": "webpack -p --config ./webpack.prod.config.js" | |
}, |