Skip to content

Instantly share code, notes, and snippets.

View robertofrontado's full-sized avatar
🐶
Working from home

Roberto Frontado robertofrontado

🐶
Working from home
View GitHub Profile
@robertofrontado
robertofrontado / XcodeGenSample-modular-project.yml
Created July 8, 2020 20:07
Project spec used to generate a modular application with unit tests
name: XcodeGenSample
options:
bundleIdPrefix: com.frontado
deploymentTarget:
iOS: 13.0
targets:
XcodeGenSample:
type: application
platform: iOS
sources:
@robertofrontado
robertofrontado / XcodeGenSample-simple-unittest-project.yml
Created July 8, 2020 19:55
Project spec used to generate a simple application with unit tests
name: XcodeGenSample
options:
bundleIdPrefix: com.frontado
deploymentTarget:
iOS: 13.0
targets:
XcodeGenSample:
type: application
platform: iOS
sources:
@robertofrontado
robertofrontado / XcodeGenSample-simple-project.yml
Created July 8, 2020 19:45
Project spec used to generate a simple application
name: XcodeGenSample
options:
bundleIdPrefix: com.frontado
deploymentTarget:
iOS: 13.0
targets:
XcodeGenSample:
type: application
platform: iOS
sources:
@robertofrontado
robertofrontado / serverless-todo-deletetodo-with-service.ts
Created May 22, 2020 17:31
serverless-todo-deletetodo-with-service
import 'source-map-support/register'
import { APIGatewayProxyHandler, APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'
import TodoService from '../../services/todoService'
export const handler: APIGatewayProxyHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
const id = event.pathParameters.id
const todoService = new TodoService()
await todoService.deleteTodoById(id)
@robertofrontado
robertofrontado / serverless-todo-gettodos-with-service.ts
Created May 22, 2020 17:30
serverless-todo-gettodos-with-service
import 'source-map-support/register'
import { APIGatewayProxyHandler, APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'
import TodoService from '../../services/todoService'
export const handler: APIGatewayProxyHandler = async (_event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
const todoService = new TodoService()
const items = await todoService.getAllTodos();
return {
@robertofrontado
robertofrontado / serverless-todo-updatetodo-with-service.ts
Created May 22, 2020 17:30
serverless-todo-updatetodo-with-service
import 'source-map-support/register'
import { APIGatewayProxyHandler, APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'
import TodoService from '../../services/todoService'
import { TodoItem } from '../../models/TodoItem'
export const handler: APIGatewayProxyHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
const id = event.pathParameters.id
const todoService = new TodoService()
@robertofrontado
robertofrontado / serverless-todo-createtodo-with-service.ts
Created May 22, 2020 17:11
serverless-todo-createtodo-with-service
import 'source-map-support/register'
import { APIGatewayProxyHandler, APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'
import TodoService from '../../services/todoService'
export const handler: APIGatewayProxyHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
const { name } = JSON.parse(event.body)
const todoService = new TodoService()
const todo = await todoService.createTodo(name)
@robertofrontado
robertofrontado / serverless-todo-todoservice.ts
Last active May 22, 2020 17:16
serverless-todo-todoservice
import * as uuid from 'uuid'
import TodoRepository from '../repositories/TodoRepository'
import { TodoItem } from '../models/TodoItem'
export default class TodoService {
todoRepository: TodoRepository;
@robertofrontado
robertofrontado / serverless-todo-todorepository.ts
Created May 22, 2020 16:59
serverless-todo-todorepository
import * as AWS from 'aws-sdk'
import { DocumentClient } from 'aws-sdk/clients/dynamodb'
import { TodoItem } from '../models/TodoItem'
export default class TodoRepository {
constructor(
private readonly docClient: DocumentClient = createDynamoDBClient(),
private readonly todoTable = process.env.TODOS_TABLE) {
@robertofrontado
robertofrontado / serverless-todo-createtodo.ts
Last active May 22, 2020 18:17
serverless-todo-createtodo
import * as AWS from 'aws-sdk'
import 'source-map-support/register'
import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'
import * as uuid from 'uuid'
import { TodoItem } from '../../models/TodoItem'
export const handler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
const { name } = JSON.parse(event.body);
const id = uuid.v4();