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
const scrollToLocation = () => { | |
const scrolledRef = React.useRef(false); | |
const { hash } = useLocation(); | |
React.useEffect(() => { | |
if (hash && !scrolledRef.current) { | |
const id = hash.replace('#', ''); | |
const element = document.getElementById(id); | |
if (element) { | |
element.scrollIntoView({ behavior: 'smooth' }); | |
scrolledRef.current = true; |
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 from 'react'; | |
import { render } from '@testing-library/react'; | |
import App from './App'; | |
import MyComponent from './MyComponent'; | |
const MockMyComponent = () => { | |
React.useEffect(() => { | |
console.log('using an effect'); | |
}); | |
return (<div>Hello World</div>); |
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 from 'react'; | |
import { render } from '@testing-library/react'; | |
import App from './App'; | |
jest.mock('./MyComponent', () => () => { | |
React.useEffect(() => { | |
console.log('using an effect'); | |
}); | |
return (<div>Hello World</div>); | |
}); |
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 from 'react'; | |
const MyMockComponent = () => (<div>Hello World</div>); | |
export default MyMockComponent; |
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 from "react"; | |
import "./styles.css"; | |
import MyComponent from "./MyComponent"; | |
export default function App() { | |
return ( | |
<div className="App"> | |
<MyComponent /> | |
</div> | |
); |
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
SlackAPI slackAPI = SlackAPIFactory.newSlackFactory() | |
.setClientId("test-id") | |
.setClientSecret("test-secret") | |
.build(); |
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
@POST | |
@Path("/events") | |
@Timed | |
public EventResponse eventResponse(Event event) { | |
if (!verificationToken.equals(event.getToken())) { | |
throw new ForbiddenException(); | |
} | |
//Custom event processing here | |
} |
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
#!/bin/bash | |
echo "Counting files open by PID $1" | |
echo "Press [CTRL-C] to stop..." | |
while : | |
do | |
lsof -p $1 | wc -l | |
sleep 1 | |
done |
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
{ | |
"name": "basic-node-server", | |
"version": "1.0.0", | |
"description": "", | |
"main": "server.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"start": "node server.js" | |
}, | |
"author": "", |
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
@SqlUpdate("INSERT INTO objects (list_of_integers) VALUES (:list_of_integers)") | |
@GetGeneratedKeys | |
int insert( @BindListIntegers("list_of_integers") List<Long> listOfIntergers); |
NewerOlder