Skip to content

Instantly share code, notes, and snippets.

View Ifmr24's full-sized avatar
😄

Fabian Mesias Ifmr24

😄
  • Santiago
  • 10:22 (UTC -04:00)
View GitHub Profile
@Ifmr24
Ifmr24 / settings.json
Created September 11, 2019 19:58
Mi configuración de VSCODE
{
"workbench.colorTheme": "One Dark Pro Vivid",
"editor.fontFamily": "'Fantasque Sans Mono', Consolas, 'Courier New', monospace",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.associations": {
"*.html": "html",
"*.js": "javascriptreact",
"*.jsx": "javascriptreact"
},
@Ifmr24
Ifmr24 / reducers.jsx
Created August 25, 2019 18:15
S3 Upload Redux Reducers
import {STARTING_UPLOAD, SUCCESS_UPLOAD, ERROR_UPLOAD} from './actions';
let INITIAL_STATE = {
starting: false,
success: false,
url: null,
error: null
};
export let uploadReducer = (state = INITIAL_STATE, action) => {
@Ifmr24
Ifmr24 / actions.jsx
Created August 25, 2019 18:13
S3 Upload Redux Actions
import axios from 'axios';
import shortid from 'shortid';
export const STARTING_UPLOAD = 'STARTING_UPLOAD';
export const SUCCESS_UPLOAD = 'SUCCESS_UPLOAD';
export const ERROR_UPLOAD = 'ERROR_UPLOAD';
export const startingUpload = () => {
return {
type: STARTING_UPLOAD
@Ifmr24
Ifmr24 / component.js
Created August 25, 2019 18:10
S3 Upload React Component
import React, { useRef } from 'react';
import { uploadFileThunk } from '../../../store/upload/actions';
import { useDispatch, useSelector } from 'react-redux';
const ComponentName = () => {
const uploadInput = useRef();
const dispatch = useDispatch();
const upload = useSelector(state => state.upload)
@Ifmr24
Ifmr24 / route.js
Created August 25, 2019 18:03
S3 Upload Files
require('dotenv').config()
var aws = require('aws-sdk');
aws.config.update({
region: 'us-east-1',
accessKeyId: process.env.AWSAccessKeyId,
secretAccessKey: process.env.AWSSecretKey
})
const S3_BUCKET = process.env.bucket
@Ifmr24
Ifmr24 / p.xml
Created August 25, 2019 17:41
S3 Permisos
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
@Ifmr24
Ifmr24 / route.js
Created August 25, 2019 14:44
Upload files from react to s3
var aws = require('aws-sdk');
aws.config.update({
region: 'us-east-1',
accessKeyId: process.env.AWSAccessKeyId,
secretAccessKey: process.env.AWSSecretKey
})
const S3_BUCKET = process.env.bucket
@Ifmr24
Ifmr24 / useLinkComponent.tsx
Created July 25, 2019 02:09
useLinkComponent.tsx
import React from 'react'
import { Link } from "react-router-dom";
interface useLinkComponentProps{
url: string,
}
const useLinkComponent: React.SFC<useLinkComponentProps> = ({url, children, ...rest}) => {
return (
<Link to={url} {...rest}>
@Ifmr24
Ifmr24 / f.txt
Last active June 27, 2019 14:57
SCSS - Watch SCSS TO CSS
npm i -g node-sass
node-sass --watch ./ -o ./
@Ifmr24
Ifmr24 / flex.css
Created May 25, 2019 05:09
CSS - Flex
.containerFlexVertical{
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
.containerFlexHorizontal{
display: flex;
flex-direction: row;
flex-wrap: wrap;