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 { GraphQLServer } = require('graphql-yoga') | |
const typeDefs = ` | |
type Query { | |
hello(name: String): String! | |
} | |
` | |
const resolvers = { | |
Query: { |
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 jwt = require('jsonwebtoken') | |
//... | |
const makeContext = (req) => { | |
if (!req.event || !req.event.headers || !req.event.headers.Authorization) { | |
return {} // no auth yet | |
} | |
const token = req.event.headers.Authorization; | |
const decoded = jwt.verify( | |
token.replace('Bearer ', ''), | |
'secret' |
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 {SchemaDirectiveVisitor} = require('graphql-tools') | |
const {defaultFieldResolver} = require('graphql') | |
//... | |
class AuthDirective extends SchemaDirectiveVisitor { | |
visitFieldDefinition(field) { | |
const {resolve = defaultFieldResolver} = field | |
const {roles: expectedRoles = []} = this.args | |
console.log(expectedRoles.length); | |
field.resolve = (...args) => { |
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
JWT_SECRET=secret |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>DisplayProductID</key> | |
<integer>23025</integer> | |
<key>DisplayProductName</key> | |
<string>SwitchResX4 - LG ULTRAWIDE</string> | |
<key>DisplayVendorID</key> | |
<integer>7789</integer> |
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, { Component } from 'react'; | |
import { Image } from 'react-native'; | |
import Svg, { Path } from 'react-native-svg'; | |
import styled from 'styled-components/native'; | |
import { Colors, moderateScale } from '../../constants'; | |
import { LevelCircleContainer } from '../shared/components/level/LevelDetails/styled'; | |
import { Box, Container, Text } from '../shared/ui'; | |
import { Icons } from '../shared/ui/icons'; | |
import { AnimatedCircularProgress } from 'react-native-circular-progress'; |
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 { Animated, Image, StyleSheet, ImageSourcePropType } from 'react-native' | |
import { | |
PinchGestureHandler, | |
PinchGestureHandlerStateChangeEvent, | |
State, | |
} from 'react-native-gesture-handler' | |
import { Container } from '../ui' | |
import Colors from '../../constants/Colors' |
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 { ShadowStyleIOS } from 'react-native'; | |
export default ( | |
depth?: 'min' | 'default' | 'max', | |
color?: string, | |
): { | |
elevation: number; | |
} & ShadowStyleIOS => { | |
switch (depth) { | |
case 'min': |
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
// TODO: typing of this could be better | |
export const getColor = <T>(colorPalette: T, defaultColor: keyof T) => ( | |
level?: keyof T, | |
) => (colorPalette[level || defaultColor] as unknown) as string; | |
export interface IColorPaletteNumbered { | |
0: string; | |
1: string; | |
2: string; | |
3: string; |
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 { useNavigation } from '@react-navigation/native'; | |
import React from 'react'; | |
import Animated, { Easing, set, useCode } from 'react-native-reanimated'; | |
import { interpolateColor, loop, useValues } from 'react-native-redash'; | |
import { scale } from 'react-native-size-matters'; | |
import { Container, Touchable } from '../../components'; | |
import { COLORS } from '../../utils'; | |
const Line: React.FC<{ color: Animated.Node<number> }> = ({ color }) => ( | |
<Animated.View |
OlderNewer