For beginners
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
| /******************************************* | |
| * | |
| * Javascript Magic Page | |
| * | |
| * Author: Sergey Ivanov <xufocoder@gmail.com> | |
| * | |
| * (\_/) | |
| * (=':'=) | |
| * ▀▀▀███████▀▀▀ | |
| * ███████ |
Official learning
3rd Party
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
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
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 = { | |
| createArray: (begin, end) => { | |
| const result = [] | |
| for (let i = begin; i<end+1; i++){ | |
| result.push(i) | |
| } | |
| return result | |
| }, | |
| fromRoman: (_str) => { | |
| var str = _str.toString() |
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 Main exposing (..) | |
| import Html exposing (..) | |
| import Html.Events exposing (..) | |
| import Random | |
| main = | |
| Html.program | |
| { init = init |
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 Html exposing (Html) | |
| import Time exposing (Time, second) | |
| main = | |
| Html.program | |
| { init = init | |
| , view = view | |
| , update = update | |
| , subscriptions = subscriptions |
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
| -- Tuple | |
| ("oh", ("my", (42, "god"))) -- touch the God | |
| (("Hello", 100), ("World", 200)) -- need "Hello World 300" | |
| ((((((("Boom has been planted"))))))) -- tuple? | |
| -- Record | |
| myRecord = |
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 Main exposing (..) | |
| import Collage exposing (Form, collage, filled, move, rect) | |
| import Color exposing (Color, rgb) | |
| import Element exposing (toHtml) | |
| import Html exposing (Html) | |
| import Keyboard | |
| import Mouse | |
| import Random | |
| import Time exposing (Time, millisecond) |
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 curry = ( | |
| f, arr = [] | |
| ) => (...args) => ( | |
| a => a.length === f.length ? | |
| f(...a) : | |
| curry(f, a) | |
| )([...arr, ...args]); |
OlderNewer