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 numbers = [ | |
| [10, 11], | |
| [90, 8], | |
| [20, 2], | |
| [80, 3], | |
| [180, -22], | |
| [30, -92], | |
| ]; | |
| const sorted = _.sortBy(numbers, (row) => row[1]); |
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 rectangular = (state) => { | |
| return { | |
| area: () => { | |
| return state.height * state.width; | |
| } | |
| }; | |
| }; | |
| const openable = (state) => { | |
| 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
| # editorconfig.org | |
| root = false | |
| [*] | |
| indent_style = space | |
| indent_size = 2 | |
| end_of_line = lf | |
| charset = utf-8 | |
| trim_trailing_whitespace = true | |
| insert_final_newline = 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
| import React, { useState, useEffect } from 'react' | |
| export default function WindowSize() { | |
| const [[windowWidth, windowHeight], setWindowSize] = useState([window.innerWidth, window.innerHeight]) | |
| const [visible, setVisible] = useState(false) | |
| useEffect(() => { | |
| let timeoutId | |
| const handleResize = () => { | |
| setWindowSize([window.innerWidth, window.innerHeight]) | |
| setVisible(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
| UPDATE wp_options SET option_value = replace(option_value, 'Existing URL', 'New URL') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
| UPDATE wp_posts SET post_content = replace(post_content, 'Existing URL', 'New URL'); | |
| UPDATE wp_postmeta SET meta_value = replace(meta_value,'Existing URL','New URL'); | |
| UPDATE wp_usermeta SET meta_value = replace(meta_value, 'Existing URL','New URL'); | |
| UPDATE wp_links SET link_url = replace(link_url, 'Existing URL','New URL'); |
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
| dropzone.on("addedfile", function(origFile) { | |
| var MAX_WIDTH = 800; | |
| var MAX_HEIGHT = 600; | |
| var reader = new FileReader(); | |
| // Convert file to img | |
| reader.addEventListener("load", function(event) { |
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
| var requests = [ | |
| { url: '/photos', status: 'complete' }, | |
| { url: '/albums', status: 'pending' }, | |
| { url: '/users', status: 'failed' } | |
| ]; | |
| var inProgress = requests.some(function(status) { | |
| return status != 'pending'; | |
| }); |
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 posts = [ | |
| { id: 1, title: 'New Post'}, | |
| { id: 2, title: 'Old Post'}, | |
| ]; | |
| const comment = { postId: 1, content: 'what great reading' }; | |
| function postForComment(posts, comment) { | |
| return posts.find(function(post) { | |
| return post.id === comment.postId; |
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 Car(model) { | |
| this.model = model; | |
| } | |
| var cars = [ | |
| new Car('Ferrari'), | |
| new Car('McLaren'), | |
| new Car('Porsche') | |
| ]; |