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
| module.exports = function flatten(nestedArrays) { | |
| if (!Array.isArray(nestedArrays)) | |
| throw new Error("flatten() called with non-array"); | |
| function* f(nestedArrays) { | |
| for (let element of nestedArrays) | |
| if (Array.isArray(element)) yield* f(element); | |
| else yield element; | |
| } | |
| return Array.from(f(nestedArrays)); | |
| } |
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 * as types from './actionsTypes'; | |
| import courseApi from '../api/mockCourseApi'; | |
| export function loadCoursesSucess(courses) { | |
| return { | |
| type: types.LOAD_COURSES_SUCCESS, | |
| courses | |
| }; | |
| } |
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 Solution do | |
| line = "10 12 50 | |
| 20 20 10" | |
| #line = IO.read :stdio, :all | |
| [a1, a2, a3, b1, b2, b3] = String.split line | |
| initial_points = %{alice: 0, bob: 0} |
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
| case 1 > 2 do | |
| true -> %{map | value: 1++} | |
| false -> %{map | value2: 2++} | |
| end | |
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 Identicon do | |
| def main(input) do | |
| input | |
| |> hash_input | |
| |> pick_color | |
| |> build_grid | |
| |> filter_odd_squares | |
| |> build_pixel_map | |
| end |
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 Identicon.Image do | |
| defstruct hex: nil, color: nil, grid: nil | |
| end |
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 Identicon do | |
| def main(input) do | |
| input | |
| |> hash_input | |
| |> pick_color | |
| |> build_grid | |
| end | |
| def build_grid(%Identicon.Image{hex: hex} = image) do | |
| grid = |
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 Cards do | |
| def create_deck do | |
| values = ["Ace", "Two", "Three"] | |
| suits = ["Spades", "Clubs", "Hearts", "Diamonds"] | |
| for value <- values, suit <- suits do | |
| "#{value} of #{suit}" | |
| end | |
| end |
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
| body { | |
| background-color: #000; | |
| color: #fff; | |
| font-family: 'Open Sans','Helvetica Neue',helvetica,sans-serif; | |
| font-size: 16px; | |
| font-weight: normal; | |
| height: 100%; | |
| letter-spacing: 0; | |
| margin: 0 auto 100px auto; | |
| min-height: 500px; |
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(props) { | |
| super(props) | |
| this.state = { | |
| items: [] | |
| } | |
| } | |
| componentDidMount() { |
NewerOlder