View usePrevious.ts
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 { useEffect, useRef } from 'react' | |
function usePrevious<T>(value: T): T { | |
const ref = useRef(value) | |
useEffect(() => { | |
ref.current = value | |
}, [value]) | |
return ref.current |
View mockCurrentDate.js
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
jest | |
.useFakeTimers({ now: currentDate, advanceTimers: true }) | |
.setSystemTime(currentDate) |
View ChildrenReversable.tsx
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 { Children, FunctionComponent, ReactNode } from "react"; | |
export interface Props { | |
children: ReactNode; | |
reverse: boolean; | |
} | |
const ChildrenReversable: FunctionComponent<Props> = ({ children, reverse }) => { | |
const componentChildren = !reverse | |
? children |
View Apollo-server.ts
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 { ApolloServer } from '@apollo/server' | |
import { startStandaloneServer } from '@apollo/server/standalone' | |
// The GraphQL schema | |
const typeDefs = `#graphql | |
type Query { | |
hello: String | |
} | |
` |
View jestMockFsTyypescript.ts
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
jest.mock('fs') | |
import fs from 'fs' | |
const mockedFs = fs as jest.Mocked<typeof fs> | |
describe('fetch', () => { | |
describe('file exists', () => { | |
beforeEach(() => { | |
mockedFs.existsSync.mockImplementation(() => true) |
View merged.yml
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
name: Merged | |
on: | |
pull_request: | |
branches: [main] | |
types: | |
- closed | |
jobs: | |
is_merged: |
View conversion.html
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
<!DOCTYPE html"> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<link href="css/style.css" rel="stylesheet" type="text/css" /> | |
<title>Exercice Sommatif 2</title> | |
</head> | |
<body> |
View automatic-join-queue.js
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
var int = setInterval(function() { | |
var yourName = "Polle" | |
var button = document.querySelector('#app > div.view.bg-background.bg-center.col-start-2 > div.grid.gap-2 > div > button') | |
if(button.disabled === false) { | |
clearInterval(int) | |
button.click() | |
window.focus() | |
setTimeout(function() { |
View gist:03e60c46ec8b31a83d26fdef76ec7d10
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 React from 'react'; | |
import { connect } from 'react-redux'; | |
import { Responsive, WidthProvider } from 'react-grid-layout'; | |
import { changeLayout, changeCurrentBreakpoint, changeWidgetOptions } from '../../actions/dashboard-actions'; | |
import { fetch as fetchLayouts, create as createLayout } from '../../actions/layouts-actions'; | |
import { fetch as fetchChartTypes } from '../../actions/chart-types-actions'; | |
import { | |
fetch as fetchWidgets, | |
create as createWidget, |
View angular-react-wrapper.ts
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 { ReactWrapperComponent } from '@angular-react/core' | |
import { | |
ChangeDetectorRef, | |
Component, | |
ElementRef, | |
EventEmitter, | |
Input, | |
NgZone, | |
OnInit, | |
Output, |
NewerOlder