This file contains 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 useWebsocketWithCallback(callback, ...args) { | |
const {lastMessage} = useWebsocket(...args); | |
const lastMessageRef = useRef(); | |
lastMessageRef.current = lastMessage; | |
useEffect(() => { | |
if (lastMessage !== lastMessageRef.current) { | |
callback(lastMessage); | |
} | |
}, [lastMessage]); | |
} |
This file contains 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
public static function provideCreate() | |
{ | |
return [ | |
[new Expectation('The password must be at least 9 characters.', 'pass')], | |
[new Expectation('The password must contain at least one uppercase and one lowercase letter.', 'passwordx')], | |
[new Expectation('The password must contain at least one number.', 'Passwordx')], | |
[new Expectation("Your chosen password is not secure enough: This is a very common password. Add another word or two. Uncommon words are better. Capitalization doesn't help very much.", 'Password1')], | |
[new Expectation("Your chosen password is not secure enough: This is similar to a commonly used password. Add another word or two. Uncommon words are better. Capitalization doesn't help very much. Predictable substitutions like '@' instead of 'a' don't help very much.", 'P@ssw0rd1')], | |
[new Expectation('Your chosen password is not secure enough: Repeats like "abcabcabc" are only slightly harder to guess than "abc". A |
This file contains 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 { useSelector, useDispatch } from 'react-redux'; | |
import { useState, useEffect } from 'react'; | |
function EditPostComponent({id}) { | |
const dispatch = useDispatch(); | |
// The initially loaded post | |
const post = useSelector(state => state.posts.postData); | |
useEffect(() => { |
This file contains 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 ResponseEnvelopeYuki<T> = ResponseEnvelopeSuccess<T> | ResponseEnvelopeFailure; | |
type ResponseEnvelopeSuccess<T> = { | |
success: true; | |
} & T; | |
type ResponseEnvelopeFailure = { | |
success: false; | |
errorMessage: string; |
This file contains 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 PrintA from '../PrintA'; | |
export const printConfig = { | |
A: { | |
component: PrintA, | |
nextTransaction: 'B', | |
}, | |
B | |
} |
This file contains 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
<?php | |
class ObjectStorage { | |
public $pairs = []; | |
public function add(object $objectKey, $value): void | |
{ | |
$this->pairs[] = [$objectKey, $value]; | |
} |
This file contains 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
Land | |
1 Access Tunnel | |
1 Bojuka Bog | |
1 Command Tower | |
1 Darkwater Catacombs | |
1 Dimir Aqueduct | |
11 Island | |
1 Myriad Landscape | |
1 Mystic Sanctuary | |
1 Path of Ancestry |
This file contains 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
impl<'a> SerializingCommon<'a> { | |
pub fn serialize_page<T>(serialized: &SerializingPage) -> SerializingCommon<'a> | |
{ | |
SerializingCommon { | |
ancestors: &serialized.ancestors, | |
assets: serialized.assets, | |
components: serialized.components, | |
content: serialized.content, | |
description: serialized.description, | |
draft: serialized.draft, |
This file contains 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
async function lol() { | |
const responseBodies = await Promise.all([ | |
fetch('http://example.com/1').then(response => response.json()), | |
fetch('http://example.com/2').then(response => response.json()), | |
]); | |
return { | |
list: responseBodies[0], | |
template_something: responseBodies[1], | |
} |
NewerOlder