Skip to content

Instantly share code, notes, and snippets.

View Fabianopb's full-sized avatar

Fabiano Brito Fabianopb

View GitHub Profile
@Fabianopb
Fabianopb / database.yml
Created April 8, 2016 15:00
Calls user credentials defined in Cloud9 from the database.yml
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
username: <%= ENV['USERNAME'] %>
password: <%= ENV['PASSWORD'] %>
host: <%= ENV['IP'] %>
@Fabianopb
Fabianopb / Gemfile
Created April 8, 2016 18:19
Configures the Gemfile to run Ruby on Rails on Heroku using Cloud9
gem 'rails_12factor', group: :production
gem 'puma'
ruby "2.3.0"
@Fabianopb
Fabianopb / Procfile
Created April 8, 2016 18:28
Procfile for configuring Puma server with Heroku in Cloud9
web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
@Fabianopb
Fabianopb / index.html
Created March 8, 2017 12:53
Page with fixed header and flexible "copyright" using only flexboxes
<html>
<body>
<div class="wrapper">
<div class="header">
header
</div>
<div class="content">
CONTENT CONTENT CONTENT
export S3_BUCKET="my-bucket-name"
export AWS_ACCESS_KEY_ID="ALOTOFCHARACTERS"
export AWS_SECRET_ACCESS_KEY="aLotMORErandomCHARACTERSformingAhash"
@Fabianopb
Fabianopb / FileUpload.jsx
Last active December 1, 2020 03:15
React component for single file upload.
import React, { useState } from 'react';
import axios from 'axios';
const FileUpload = () => {
// If you are using TypeScript the state will be
// const [file, setFile] = useState<FileList | null>(null);
const [file, setFile] = useState(null);
const submitFile = async () => {
try {
@Fabianopb
Fabianopb / server.js
Last active June 25, 2023 16:03
Node server using multer to upload files to AWS S3.
const express = require('express');
const app = express();
const AWS = require('aws-sdk');
const fs = require('fs');
const fileType = require('file-type');
const multiparty = require('multiparty');
// configure the keys for accessing AWS
AWS.config.update({
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
@Fabianopb
Fabianopb / express-react-ts | structure.txt
Last active September 15, 2018 12:53
express-react-ts
express-react-ts
├── backend/
├── frontend/
├── .gitignore
└── package.json
@Fabianopb
Fabianopb / express-react-ts | .gitignore
Created September 15, 2018 12:52
express-react-ts
# dependencies
node_modules
# build
dist
build
# testing
coverage
@Fabianopb
Fabianopb / express-react-ts | package.json
Created September 15, 2018 13:17
express-react-ts-ci root install scripts
"scripts": {
"install": "yarn install:backend && yarn install:frontend",
"install:backend": "cd backend && yarn install",
"install:frontend": "cd frontend && yarn install",
"build": "yarn build:backend && yarn build:frontend",
"build:backend": "cd backend && yarn build",
"build:frontend": "cd frontend && yarn build",
"start": "concurrently \"yarn start:backend\" \"yarn start:frontend\"",
"start:db": "sudo mongod --dbpath /data/test/ --port 27017",
"start:backend": "cd backend && yarn start",