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 delay = async () => { | |
| const delayPromise = new Promise((resolve) => { | |
| setTimeout(resolve, 20000); | |
| }); | |
| return delayPromise; | |
| }; | |
| // await delay(); |
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, { forwardRef } from "react"; | |
| // Declare a type that works with generic components | |
| type FixedForwardRef = <T, P = {}>( | |
| render: (props: P, ref: React.Ref<T>) => React.ReactElement | |
| ) => (props: P & React.RefAttributes<T>) => React.ReactElement; | |
| // Cast the old `forwardRef` to the new one | |
| export const fixedForwardRef = | |
| forwardRef as FixedForwardRef; |
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
| [ | |
| { | |
| "name": "Afghanistan", | |
| "code": "AF / AFG" | |
| }, | |
| { | |
| "name": "Albania", | |
| "code": "AL / ALB" | |
| }, | |
| { |
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 getEmojiFlag = (code) => { | |
| const codePoints = code | |
| .toUpperCase() | |
| .split('') | |
| .map(char => 127397 + char.charCodeAt()); | |
| return String.fromCodePoint(...codePoints); | |
| } | |
| getEmojiFlag('pl'); // 🇵🇱 |
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 calculateDSTDiff = (timezone) => { | |
| const januaryOffset = moment.tz({ month: 0, day: 1 }, timezone).utcOffset(); | |
| const juneOffset = moment.tz({ month: 5, day: 1 }, timezone).utcOffset(); | |
| return Math.abs(juneOffset - januaryOffset); | |
| }; |
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 randomDate(start, end) { | |
| return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); | |
| } | |
| console.log(randomDate(new Date(2012, 0, 1), new Date())); |
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 { render } from "react-dom"; | |
| import { MemoizedFlow } from "react-memoize"; | |
| const StatelessTable = ({ list, page, onPageChange, onSortChange }) => ( | |
| <table border={1} cellPadding={5}> | |
| <thead> | |
| <tr> | |
| <th># counter</th> | |
| <th>data from "list"</th> |
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
| git tag -d TagName && git push origin :refs/tags/TagName |
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
| [ | |
| {"name":"Afghanistan","let2":" AF","let3":"AFG"}, | |
| {"name":"Albania","let2":"AL","let3":"ALB"}, | |
| {"name":"Algeria","let2":"DZ","let3":"DZA"}, | |
| {"name":"American Samoa","let2":"AS","let3":"ASM"}, | |
| {"name":"Andorra","let2":"AD","let3":"AND"}, | |
| {"name":"Angola","let2":"AO","let3":"AGO"}, | |
| {"name":"Anguilla","let2":"AI","let3":"AIA"}, | |
| {"name":"Antigua and Barbuda","let2":"AG","let3":"ATG"}, | |
| {"name":"Argentina","let2":"AR","let3":"ARG"}, |
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
| services: | |
| my.block.custom: | |
| class: My\BlockBundle\Block\CustomBlock | |
| tags: | |
| - { name: landing_page_field_type.block_type, alias: custom } |
NewerOlder