Skip to content

Instantly share code, notes, and snippets.

View twitter-advanced-search.txt
// get all tweets from @prisma
from:prisma
// tweets between two accounts
from:ryanchenkie to:chris__sev
// tweets by a hashtag but only with images
#InaugurationDay filter:images
// keywords by people on a specific list
View function-component-interface.ts
interface FunctionComponent<P = {}> {
(props: PropsWithChildren<P>, context?: any): ReactElement<any, any> | null;
propTypes?: WeakValidationMap<P>;
contextTypes?: ValidationMap<any>;
defaultProps?: Partial<P>;
displayName?: string;
}
View react-types.ts
import React, { useState } from 'react';
// types and interfaces for props
type DashboardProps = {
totalSales: number;
};
const Dashboard: React.FC<DashboardProps> = (props) => (
<section>
<p>Total Sales: {props.totalSales}</p>
View shirt-shop-data.json
[
{
"name": "T-Shirt",
"description": "Great fit, super comfy",
"image": "https://i.imgur.com/KeQtXT3.png",
"price": 25,
"sku": "123"
},
{
"name": "Sweater",
View AuthContext.js
...
return (
<Provider
value={{
authState,
setAuthState: authInfo => setAuthInfo(authInfo)
}}
>
{children}
View disable-vscode-autocomplete.json
{
"editor.acceptSuggestionOnEnter": "off",
"editor.hover.enabled": false,
"editor.quickSuggestions": false,
"editor.quickSuggestionsDelay": 10,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestOnTriggerCharacters": false,
"editor.wordBasedSuggestions": false
}
View graphql-parse-fields.js
const { ApolloServer, gql } = require('apollo-server');
const parseFields = require('graphql-parse-fields');
const typeDefs = gql`
type User {
firstName: String
lastName: String
age: Int
}
View speakdotdev.graphql
type Speaker {
firstName: String!
lastName: String!
email: String!
avatarLink: String
shortBio: String
fullBio: String
status: String
location: SpeakerLocation
shouldDisplayLocation: Boolean
View avatar-rule.js
function (user, context, callback) {
context.idToken["http://your-domain/azure_photo"] = user.azure_photo;
callback(null, user, context);
}