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 { getRandomWordSync, getRandomWord } = require("word-maker"); | |
console.log("It works!"); | |
// 1 | |
[...Array(100)].map((_, index) => | |
console.log(`${index + 1}: ${getRandomWordSync()}`) | |
); | |
// 2 |
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() { | |
var cornify_count = 0; | |
var cornify_add = function(options) { | |
// Track how often we cornified. | |
cornify_count += 1; | |
// Create a container DIV for our 'corn or 'bow. | |
var div = document.createElement('div'); | |
div.style.position = 'fixed'; | |
// Prepare our lovely variables. | |
var numType = 'px'; |
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
// How to ensure that our animation loop ends on component unount | |
componentDidMount() { | |
this.startLoop(); | |
} | |
componentWillUnmount() { | |
this.stopLoop(); | |
} |
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 categories = [ | |
{ | |
name: 'clothing', | |
category: null | |
}, | |
{ | |
name: 'adult', | |
category: 'clothing' | |
}, | |
{ |
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
// [1] => 1 | |
// [1, [2,3,4]] => [1,2,3,4] | |
// [1, [2,3, [4,5]]] => [1,2,3,4,5] | |
const flatten = (arr) => | |
arr.reduce((acc, next) => | |
acc.concat(Array.isArray(next) ? flatten(next) : next), []); | |
const data = [1, [2, 3, [4, 5]]]; | |
flatten(data); |
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 trampoline = fn => (...args) => { | |
let result = fn(...args) | |
while (typeof result === 'function') { | |
result = result() | |
} | |
return result | |
} |
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
// the trampoline wrapper function | |
const trampoline = fn => (...args) => { | |
let result = fn(...args) | |
while (typeof result === 'function') { | |
result = result() | |
} | |
return result | |
} | |
const countDown = (n) => { |
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 countDown = (n) => { | |
console.log(n); | |
return (n > 0) ? setTimeout(() => countDown(n - 1), 0) : n; | |
} | |
const num = 0; | |
countDown(num); |
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 countDown = (n) => { | |
console.log(n); | |
return (n > 0) ? countDown(n - 1) : n; | |
} | |
countDown(10); |
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 'jest-styled-components'; | |
import { ThemeProvider } from 'styled-components'; | |
import renderer from 'react-test-renderer'; | |
import { mount } from 'enzyme'; | |
import SubmitBlock from '../SubmitBlock'; | |
import { fashionTradeTheme as theme } from '../../../../constants/theme'; | |
describe('snapshots', () => { | |
describe('it should render the compoent', () => { |
NewerOlder