Skip to content

Instantly share code, notes, and snippets.

@johndavedecano
johndavedecano / CalculatePostRating.php
Created October 12, 2018 12:56
Calculate Post Rating
<?php
namespace App\Jobs;
use App\Entities\Review;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@johndavedecano
johndavedecano / laravel-authentication.txt
Last active October 15, 2018 14:22
laravel authentication primer
Laravel Authentication Primer
1. Objective - to learn how to secure your web apps by adding authentication system with laravel framework.
2. Pre Requisite - Basic PHP or Laravel Knowledge
3. Introduction
- What is authentication?
- Different kinds of authentication.
- Session based
- Token Based
- Whats the difference between authorization and authentication?
@johndavedecano
johndavedecano / LoginController.php
Created October 16, 2018 10:02
Auth/LoginController
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
@johndavedecano
johndavedecano / component.jsx
Last active October 17, 2018 15:17
Handle multiple requests with reactJS
import React from 'react'
import axios from 'axios'
export default class extend React.Component {
state = {
profile: {},
memes: {},
isLoaded: false,
isLoading: false
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Socialite;
use App\User;
module.exports = {
"roots": [
"<rootDir>/src"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
"moduleFileExtensions": [
"ts",
@johndavedecano
johndavedecano / default.conf
Last active January 2, 2019 07:18
PHP 7.2 Laravel Nginx Basic Configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
root /home/ubuntu/project/public;
index index.php index.html;
server_name _;
import React from 'react'
import debounce from 'lodash/debounce'
import PT from 'prop-types'
class Slider extends React.Component {
static defaultProps = {
timeout: 3000,
autoPlay: true,
transition: 'ease',
@johndavedecano
johndavedecano / CORS CLoudfront
Last active March 7, 2019 17:39
Setup Laravel on Ubuntu 18.04
https://medium.com/@MicroPyramid/cors-with-amazon-s3-and-cloudfront-2792311c4b46
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
@johndavedecano
johndavedecano / awc-ecs-access-to-aws-efs.md
Created July 8, 2019 15:30 — forked from duluca/awc-ecs-access-to-aws-efs.md
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide: