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'; | |
| class UserCardExample extends React.Component { | |
| constructor() { | |
| super(); | |
| this.state = { | |
| user: "", | |
| fetching: true | |
| }; | |
| } |
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
| /* | |
| Generate Collatz Sequences and compare and discover sizes from sequences | |
| To avoid state mutation, there is no default memoized sequence | |
| */ | |
| function* Range(start = 0, end = Infinity, step = 1) { | |
| for (let i = start; i <= end; i += step) { | |
| yield i; | |
| } | |
| } |
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
| /* | |
| Sequentially / synchronously process an array of elements through a function that returns a Promise. | |
| Func must be a function that returns a Promise | |
| Basic usage: Elements must be processed in sequence, but the Process Function | |
| returns a Promise, so it must be resolved until the next element is processed | |
| Credits to Mattias Petter Johansson, https://github.com/mpj | |
| */ |
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
| /* | |
| Defined the function Pipe. | |
| Pipe accepts a list of functions and makes use of composition to apply the resulting values in sequence, given an initial value | |
| As an example, a userList mock is created and the data is filtered, processed and then logged through the function Pipe. | |
| */ | |
| export default const pipe = (...funcList) => input => funcList.reduce((acc, func) => func(acc), input); |
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
| /* | |
| Returns a well-formed generator from a given argument even if said argument is non-iterable. | |
| If argument is an iterable, iterating via for...of, calls to .next() or other methods yields the argument values. | |
| if argument is not an iterable, returns the default value as per Iteration Protocol: {value: undefined, done: true} | |
| */ | |
| function* generatorFrom (element) { | |
| if (element && element[Symbol.iterator]) yield* element; | |
| return; | |
| } |
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 getNestedProperty = (obj, path) => { | |
| const isObject = obj => Object.prototype.toString.call(obj) === '[object Object]' | |
| if(!isObject(obj) || typeof path !== 'string') return false | |
| const properties = path.split('.') | |
| let state = obj | |
| for (const prop of properties) { | |
| if (!state[prop]) return null | |
| state = state[prop] | |
| } | |
| return state |
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 Defining a LinkedList Functor and its ListNode members. | |
| */ | |
| //STILL NEED TO IMPLEMENT INDEX MODIFICATION AFTER PREPEND AND REMOVE | |
| 'use strict' | |
| const isPrimitive = value => typeof value === "boolean" || value && typeof value === "number" || typeof value !== "object" && typeof value !== "function" && value.constructor !== Array; |
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
| /* | |
| Defines the data structure Range as a Custom Iterator, a Custom Generator and as a Class. | |
| Range makes use of the Iterator Protocol and Symbol.iterator to generate new values | |
| to the user and takes three optional arguments: | |
| - start: the starting value of the range | |
| - end: the final value of the range upon which the Range will be done | |
| - step: the increment upon the returned values | |
| */ | |
| function rangeAsIterator() { |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="description" content="JS Image Appending"> | |
| <meta name="author" content="Marcos de Andrade Pinto Filho"> | |
| <title>HTML5 Template</title> | |
| </head> | |
| <body> | |
| <main class="imageContainer"> |
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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <style> | |
| .droppableBox { | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| width: 250px; | |
| height: 70px; |