Skip to content

Instantly share code, notes, and snippets.

function CommunicationList() {
const [communications, setCommunications] = useState<Communication[] | null>(
null
);
useEffect(() => {
fetch("/communications")
.then((res) => res.json())
.then(setCommunications);
}, []);
expect(CommunicationQueue).to receive(:enqueue).with(hash_including(text: 'Some Message2')))
describe 'The SendCommunicationService' do
it 'Queues an email send with the correct text' do
# arrange the messaging layer with a mock implementation to ensure
# messages are sent with the correct text at *any* point during the test
expect(CommunicationQueue).to receive(:enqueue) do |message_payload|
# assert
expect(message_payload[:text].to).eq('Some Message')
end
UserCommunication.create!(user_id: 3, text: 'Some Message', type: 'email')
select
customer_to_chase.name,
customer_to_chase.telephone_number,
upcoming_reservation.start,
upcoming_reservation.finish,
upcoming_reservation.cost
from
reservation_request upcoming_reservation
left outer join confirmed_booking confirmed_booking
on confirmed_booking.reservation_request_id = upcoming_reservation.id
@nedgrady
nedgrady / find_reservations.sql
Last active October 18, 2024 21:51
find_reservations.sql
select
c.name,
c.telephone_number,
rr.start,
rr.finish,
rr.cost
from
reservation_request rr
left outer join confirmed_booking cb on cb.reservation_request_id = rr.id
inner join customer c on c.id = rr.customer_id
function isPrime(numberToCheck: number) {
if (numberToCheck <= 1) return false;
for (let possibleDivisor = 2; possibleDivisor <= numberToCheck; possibleDivisor++) {
if (numberToCheck % possibleDivisor === 0) return false;
}
return true;
}
const numbers = [99999, 12, 15];
const allFactors = [];
function isPrime(num: number) {
if (num <= 1) return false;
for (let i = 2; i <= num; i++) {
if (num % i === 0) return false;
}
return true;
}
const numbers = [99999, 12, 15];
const allFactors = [];
####
# Backup the conents of f_a to f_b
# then compress f_a by removing all duplicates
####
def backup_then_remove_duplicates(
f_a,
f_b
)
f_a = File.open(f_a, File::RDWR)
require "set"
####
# Backup the conents of the remove_duplicates_file to the backup_destination_file
# Then remove all duplicated lines from the remove_duplicates_file
####
def backup_then_remove_duplicates(
backup_destination_file_path,
remove_duplicates_file_path
)
[Test]
public void FullNameConcatenatesFirstAndLastName()
{
// Arrange
Person personUnderTest = new()
{
FirstName = "SomeFirstName",
LastName = "SomeSecondName",
Email = "[email protected]"
};