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 get_minimal_paths(root_directory, paths_to_exclude=None, paths_to_include=None): | |
| """ | |
| Gets the "minimal" paths that comprise a directory's contents while excluding a set of child paths. | |
| For example, given this directory hierarchy: | |
| C:/Engine | |
| Binaries | |
| Documentation | |
| Plugins |
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
| // Include "Sockets" in the `PrivateDependencyModuleNames` list in the Build.cs file. | |
| #include "SocketSubsystem.h" | |
| FString GetHost() | |
| { | |
| bool bCanBindAll; | |
| return ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->GetLocalHostAddr(*GLog, bCanBindAll)->ToString(false); | |
| } |
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 StorageArray { | |
| private storage: Storage; | |
| constructor(storage: Storage) { | |
| this.storage = storage; | |
| } | |
| get(key: string): string[] | null { | |
| const jsonString = this.storage.getItem(key); |
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, useImperativeHandle, useRef} from 'react'; | |
| interface Props { | |
| children: React.ReactNode; | |
| className?: string; | |
| collapsedHeight: number; | |
| isCollapsed: boolean; | |
| transitionDuration?: string; | |
| } |
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
| #!/usr/bin/env bash | |
| actual=$1 | |
| expected=$2 | |
| # https://stackoverflow.com/a/5947802 | |
| GREEN='\033[0;32m' | |
| RED='\033[0;31m' | |
| RESET='\033[0m' # No Color |
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
| package com.matthewminer; | |
| import org.apache.commons.io.IOUtils; | |
| import javax.servlet.ReadListener; | |
| import javax.servlet.ServletInputStream; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletRequestWrapper; | |
| import java.io.ByteArrayInputStream; | |
| import java.io.IOException; |
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 LeastRecentlyInsertedCache<T> implements Iterable<T> { | |
| private maxSize: number; | |
| // Set objects maintain insertion order, making them appropriate for keeping track of when values | |
| // are added relative to each other. | |
| private set = new Set<T>(); | |
| constructor(maxSize: number) { | |
| this.maxSize = maxSize; | |
| } |
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 basicAuthMiddleware(request, response, next) { | |
| const { authorization = '' } = request.headers; | |
| const [, credentials] = authorization.split(' '); | |
| const decoded = new Buffer(credentials || '', 'base64').toString(); | |
| const splitIndex = decoded.indexOf(':'); | |
| const username = decoded.substring(0, splitIndex); | |
| const password = decoded.substring(splitIndex + 1); | |
| // TODO: supply valid values for username and password | |
| if (username !== USERNAME || password !== PASSWORD) { |
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 PropTypes from 'prop-types'; | |
| import { Component } from 'react'; | |
| const eventListenerOptions = { capture: true, passive: true }; | |
| // Events that signify that the user is still active. | |
| const eventNames = ['keydown', 'mousedown', 'touchstart']; | |
| class InactivityReset extends Component { | |
| constructor(props) { |
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 moment from 'moment'; | |
| import PropTypes from 'prop-types'; | |
| import { Component, createElement as h } from 'react'; | |
| class RelativeTime extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.intervalId = null; | |
| this.state = { output: moment(props.time).fromNow() }; | |
| this.updateOutput = this.updateOutput.bind(this); |