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: | |
| zookeeper: | |
| image: confluentinc/cp-zookeeper:7.4.4 | |
| environment: | |
| ZOOKEEPER_CLIENT_PORT: 2181 | |
| ZOOKEEPER_TICK_TIME: 2000 | |
| ports: | |
| - 22181:2181 | |
| broker: |
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 LruPolicy from './lru'; | |
| import { IEvictionPolicy } from './types'; | |
| class Cache { | |
| private _evictionPolicy: IEvictionPolicy; | |
| constructor(evictionPolicy: IEvictionPolicy) { | |
| this._evictionPolicy = evictionPolicy; | |
| } |
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 machine = { | |
| initial: 'cart', | |
| states: { | |
| cart: { | |
| on: { | |
| CHECKOUT: 'shipping', | |
| }, | |
| }, | |
| shipping: { | |
| on: { |
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 cProfile | |
| import io | |
| import pstats | |
| is_profiler_enabled = False | |
| def profile(func): | |
| def enabled_wrapper(*args, **kwargs): | |
| pr = cProfile.Profile() |
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
| // So each country array has the following information: | |
| // [ | |
| // Country name, | |
| // iso2 code, | |
| // International dial code, | |
| // Order (if >1 country with same dial code), | |
| // Area codes (if >1 country with same dial code) | |
| // ] | |
| const defaultCountriesData = [ | |
| ['Afghanistan (افغانستان)', 'af', '93'], |
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
| def longestPalindrome(s): | |
| print(s) | |
| length = len(s) | |
| l = [[1] * length] * length | |
| # 'ABBAACBA' |
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 = { | |
| /* | |
| Print spaces b/w brackets in obj literals | |
| true - Example: { foo: bar }. | |
| false - Example: {foo: bar}. | |
| */ | |
| bracketSpacing: true, | |
| /* | |
| use single quotes instead of double. | |
| */ |
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
| <FadeIn> | |
| <Element>Element 1</Element> | |
| <Element>Element 2</Element> | |
| <Element>Element 3</Element> | |
| <Element>Element 4</Element> | |
| <Element>Element 5</Element> | |
| <Element>Element 6</Element> | |
| </FadeIn> | |
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 range(end) { | |
| return Array.from({ length: end }, (_, index) => index); | |
| } | |
| range(4); // => [0, 1, 2, 3] | |
| /* | |
| map function that simply returns the current index. | |
| */ |
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 length = 3; | |
| const resultA = Array.from({ length }, () => ({})); | |
| const resultB = Array(length).fill({}); | |
| resultA; // => [{}, {}, {}] | |
| resultB; // => [{}, {}, {}] | |
| resultA[0] === resultA[1]; // => false | |
| resultB[0] === resultB[1]; // => true |
NewerOlder