Skip to content

Instantly share code, notes, and snippets.

@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>
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 / 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 _;
module.exports = {
"roots": [
"<rootDir>/src"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
"moduleFileExtensions": [
"ts",
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Socialite;
use App\User;
@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
}
@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 / 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 / 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.xml
Created October 8, 2018 11:53
Laravel Coding Standard for PHP Storm
<code_scheme name="Laravel">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />