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
# Node.js Function App to Linux on Azure | |
# Build a Node.js function app and deploy it to Azure as a Linux function app. | |
# Add steps that analyze code, save build artifacts, deploy, and more: | |
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript | |
trigger: | |
- main | |
variables: |
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
ls | cat -n | while read n f; do mv "$f" "new name${n}_new name$n.${f##*.}"; done |
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
throw new ExecutionError('USER_ERROR', 'Invalid credentials', 401); |
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
try { | |
const user = await UserService.userMethod(req.body.code); | |
res.status(200).json(loggedUser); | |
} catch (e) { | |
res.status(e.status || 400).json({ | |
error: e.name, | |
message: e.message, | |
}); | |
} |
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
class ExecutionError extends Error { | |
constructor(name, message, status = 400) { | |
super(); | |
this.name = name; | |
this.message = message; | |
this.status = status; | |
} | |
} | |
module.exports = ExecutionError; |
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 { useMutation } from '@apollo/react-hooks'; | |
import gql from 'graphql-tag'; | |
import { Box, Flex } from '@primer/components'; | |
import styled from 'styled-components'; | |
const ADD_CLAP_MUTATION = gql` | |
mutation addClap($postId: String!) { | |
addClap(postId: $postId) { | |
id |
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 { Flex, Box } from '@primer/components'; | |
import { useQuery } from '@apollo/react-hooks'; | |
import gql from 'graphql-tag'; | |
import PostItem from '../PostItem/PostItem'; | |
const GET_POSTS_QUERY = gql` | |
query posts { | |
posts { |
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, { useRef, useState } from 'react'; | |
import { Box, Flex, Button, TextInput, Flash } from '@primer/components'; | |
import { useMutation } from '@apollo/react-hooks'; | |
import gql from 'graphql-tag'; | |
const ADD_POST_MUTATION = gql` | |
mutation addPost($post: AddPostInput!) { | |
addPost(post: $post) { | |
id | |
picture |
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 { ApolloClient } from 'apollo-client'; | |
import { InMemoryCache } from 'apollo-cache-inmemory'; | |
import { createUploadLink } from 'apollo-upload-client'; | |
import { onError } from 'apollo-link-error'; | |
import { ApolloLink } from 'apollo-link'; | |
const client = new ApolloClient({ | |
link: ApolloLink.from([ | |
onError(({ graphQLErrors, networkError }) => { | |
if (graphQLErrors) |
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 fs = require('fs'); | |
const glob = require('glob-fs')(); | |
const flowRemoveTypes = require('flow-remove-types'); | |
const firstline = require('firstline'); | |
const files = glob.readdirSync('src/**/@(**.js|**.jsx)', {}); | |
files.forEach(async (file) => { | |
console.log(`Found file ${file}, checking if it has flow annotion on first line`); | |
const hasFlowAnnotation = await firstline(file); |
NewerOlder