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
server { | |
listen 8080; | |
server_name nginx.test.com; | |
gzip on; | |
gzip_disable "msie6"; | |
gzip_vary on; | |
gzip_proxied any; | |
gzip_comp_level 6; |
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
export async function main(event, context) { | |
const params = { | |
TableName: process.env.tableName, | |
KeyConditionExpression: "userId = :userId", | |
ExpressionAttributeValues: { | |
":userId": event.requestContext.identity.cognitoIdentityId | |
} | |
}; | |
try { |
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
// Component Helmet | |
<Helmet> | |
<title>{post.title}</title> | |
<meta name="description" content={post.teaser.concat('...')} /> | |
<meta property="og:title" content={post.title} /> | |
<meta property="og:url" content={window.location.href} /> | |
<meta property="og:type" content="article" /> | |
<meta property="og:description" content={post.teaser} /> | |
<meta property="og:image" content={post.posttitleimage?.image || MockPostImage} /> |
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
const FollowButton: React.FC<IProps> = (props) => { | |
const contributorUUIDList = useMemo(() => props.conversation.contributors.map(e => e.uuid), [props.conversation]); | |
if (!props.user.token) { | |
return (<Button><Link to="/user/registration/">Follow</Link></Button>) | |
} | |
if (props.user.token && contributorUUIDList.indexOf(props.user.uuid) !== -1) { | |
return <div></div> | |
} |
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
""" | |
Bash commands | |
""" | |
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete | |
find . -path "*/migrations/*.pyc" -delete |
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
# dump database data for relavant apps to fixture directory | |
python manage.py dumpdata --indent 4 answers dependencies modules options questions respondents survey_explainers survey_results surveys tags tenants users > fixtures/initial_data.json |
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
# run simple pip command to install binaries directly | |
pip install psycopg2-binary |
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
# Resetting the database without deleting it | |
DROP SCHEMA public CASCADE; | |
CREATE SCHEMA public; | |
# Deleting all entries from a table | |
DELETE FROM table_name; |
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 { useState, useEffect, useRef } from "react"; | |
export default function App() { | |
const initalState = 0; | |
const [count, setCount] = useState(initalState); | |
const counterRef = useRef(initalState); | |
useEffect(() => { | |
counterRef.current = count; | |
}) |
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 "./styles.css"; | |
import { useState, useEffect } from "react"; | |
export default function App() { | |
const initalState = 0; | |
const [count, setCount] = useState(initalState); | |
useEffect(() => { | |
setInterval(() => { | |
setCount(old => old + 1); |
OlderNewer