Skip to content

Instantly share code, notes, and snippets.

View GergKllai1's full-sized avatar
🥷

Gergö Kallai GergKllai1

🥷
  • Gothenburg, Sweden
View GitHub Profile
const dateParseHelper = sessions => {
let options = {
day: "numeric",
month: "short",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
hourCycle: "h24"
};
const convertedSessions = sessions.map(session => {
const logger = state => {
return next => {
return action => {
console.log("Previous state:");
console.log(state.getState());
console.log("Dispatching action:");
console.log(action);
const result = next(action);
console.log("Next state:");
console.log(state.getState());
selected_session = Session.first
sessions = Session.all
sessions.each do | session |
if selected_session.id != session.id
puts session if (session.start_date .. session.end_date).cover?(selected_session.start_date) && (session.start_date .. session.end_date).cover?(selected_session.end_date)
end
end
input[name="dob"]:before {
content: "Date of Birth";
color: #aaa;
margin-right: 0.5em;
}
input[name="dob"]:focus:before,
input[name="dob"]:valid:before {
content: "";
}
@GergKllai1
GergKllai1 / FlashMessage.test.js
Created October 2, 2019 14:01
An example of testing setTimeOut and useState hook rerender
import React from "react";
import { mount } from "enzyme";
import FlashMessage from "./FlashMessage";
import { act } from "react-dom/test-utils";
describe("FlashMessage", () => {
let container, messageMock;
beforeEach(() => {
jest.useFakeTimers();
messageMock = "Test message";