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
| type Params = {}; | |
| type ContextBase<R, C> = { | |
| router: Router<R, C>; | |
| route: Route<R, C>; | |
| next: () => Promise<R>; | |
| url: string; | |
| baseUrl: string; | |
| path: string; | |
| params: Params; |
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
| window.$ = (arg) => | |
| typeof arg === 'function' | |
| ? window.document.addEventListener('DOMContentLoaded', arg) | |
| : window.document.querySelector(arg); | |
| window.$.ajax = window.fetch; |
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
| typedef bool Predicate(T); | |
| List<T> filter<T>(List<T> list, Predicate predicate) { | |
| final newList = []; | |
| for (final item in list) { | |
| if (predicate(item)) { | |
| newList.add(item); | |
| } | |
| } |
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 'package:barcode_scan/barcode_scan.dart'; | |
| import '../entity/friend_code.dart'; | |
| import '../entity/scaned_friend_code.dart'; | |
| class FriendCodeScanService { | |
| Future<FriendCode> scan() async { | |
| String data; | |
| try { | |
| data = await BarcodeScanner.scan(); |
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 javaenv | |
| if test (count $argv) -eq 0 | |
| /usr/libexec/java_home -V | |
| else | |
| switch $argv[1] | |
| case 'ls' | |
| /usr/libexec/java_home -V | |
| case 'set' | |
| set -xU JAVA_HOME (/usr/libexec/java_home -v $argv[2]) | |
| end |
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 'dart:async'; | |
| import 'package:firebase_messaging/firebase_messaging.dart'; | |
| import 'package:meta/meta.dart'; | |
| class MessageTray { | |
| MessageTray({@required FirebaseMessaging messaging}) | |
| : assert(messaging != null), | |
| _onMessage = StreamController(), | |
| _onResume = StreamController(), | |
| _onLaunch = StreamController() { |
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 A extends React.Component { | |
| constructor(props, context) { | |
| super(props, context); | |
| this.globalCallbackName = 'kdjlwkqe'; | |
| this.ref = React.createRef(); | |
| } | |
| componentDidMount() { | |
| global[this.globalCallbackName] = () => new google.maps.Map(this.ref.current, { |
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
| export default class BinaryHeap<T> { | |
| constructor(orderComparator: OrderComparator<T>) { | |
| this.orderComparator = orderComparator; | |
| this.values = []; | |
| } | |
| private orderComparator: OrderComparator<T>; | |
| private values: T[]; | |
| get length(): number { |
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 * as React from "react"; | |
| import * as ReactDOMServer from "react-dom/server"; | |
| function SomeComponent() { | |
| return React.createElement(StyledDiv, null, "Hello!"); | |
| } | |
| const StyledDiv = styled.div` | |
| color: red; | |
| `; |
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 fs = require("fs"); | |
| const path = require("path"); | |
| const fileNames = fs.readdirSync(path.resolve(__dirname, "./solutions")); | |
| const testFiles = fileNames.filter(fileName => fileName.endsWith("_test.ts")); | |
| for (const fileName of testFiles) { | |
| // const fileName = testFiles[Math.floor(Math.random() * testFiles.length)]; | |
| // const fileName = "search_a2d_matrix2_test.ts"; |