Skip to content

Instantly share code, notes, and snippets.

View brunohcastro's full-sized avatar

Bruno Henrique de Castro brunohcastro

View GitHub Profile

Desafio

Vamos montar uma listagem de blog posts, com usuários e comentários. A API que vamos usar pode ser encontrada no seguinte repositório: https://github.com/typicode/json-server

Tarefa 1 - Listagem de Posts e Comentários

@brunohcastro
brunohcastro / download-file.js
Last active November 5, 2018 00:50 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@brunohcastro
brunohcastro / .gitignore
Created December 12, 2017 20:30 — forked from bergie/.gitignore
Node.js email handling examples
config.json
reading-image.png
@brunohcastro
brunohcastro / README.md
Created September 3, 2017 19:20 — forked from mrkpatchaa/README.md
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

@brunohcastro
brunohcastro / Commit Formatting.md
Created August 16, 2017 14:40 — forked from brianclements/Commit Formatting.md
Angular Commit Format Reference Sheet

Git Commit Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the AngularJS change log.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

@brunohcastro
brunohcastro / gpg-import-and-export-instructions.md
Created April 3, 2017 17:53 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

#!/usr/bin/bash
#
# Script to notify user for new mails.
# Crontab ex:
# */3 * * * * ~/bin/offlineimap-notify.sh
#
#run OfflineIMAP once, with quiet interface
offlineimap -o -q -u quiet
@brunohcastro
brunohcastro / consul-register.sh
Created October 31, 2016 06:35 — forked from double-z/consul-register.sh
Register with Chef-Provisioning-Registry via consul
#!/bin/bash
MACHINE_TYPE=$1
USER_NAME='provisioner'
USER_HOME="/home/$USER_NAME"
if [ -d $USER_HOME ]
then
echo "ALREADY REGISTERED"
else
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
@brunohcastro
brunohcastro / app.js
Created April 17, 2016 16:58 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');