Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Pedro Costa plcosta

🎯
Focusing
Block or report user

Report or block plcosta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@plcosta
plcosta / cpf.fish
Created Jul 24, 2019
Brazilian CPF generator - Fish shell function
View cpf.fish
function cpf
set CPF (curl -X POST -w "\n" -d "acao=gerar_cpf" -d "pontuacao=S" -s https://www.4devs.com.br/ferramentas_online.php)
if type -q pbcopy
echo $CPF | pbcopy;
echo "$CPF copied to clipboard"
else if type -q xclip
echo $CPF | xclip -selection clipboard;
echo "$CPF copied to clipboard"
else
echo $CPF
@plcosta
plcosta / .gitlab-ci.yml
Created Apr 10, 2019
GitLab CI - Review Apps - Example
View .gitlab-ci.yml
image: ruby:2.5.1
cache:
key: "$CI_COMMIT_REF_NAME"
untracked: true
variables:
POSTGRES_DB: dbname
POSTGRES_USER: dbuser
POSTGRES_PASSWORD: dbpass
@plcosta
plcosta / cloudflare-dyndns-ruby.rb
Created Dec 19, 2018
Dynamically update Cloudflare DNS records with the machine's current external IP.
View cloudflare-dyndns-ruby.rb
#!/usr/bin/env ruby
require 'net/http'
require 'json'
class Cloudflare
def initialize(email, key)
@email = email
@key = key
end
@plcosta
plcosta / App.vue
Created Dec 18, 2018
Vue.js - Multiple Layouts
View App.vue
<template>
<router-view></router-view>
</template>
<script>
export default {
name: 'App'
}
</script>
@plcosta
plcosta / axios.js
Last active Dec 14, 2018
Axios Config
View axios.js
'use strict'
import Vue from 'vue'
import axios from 'axios'
// Full config: https://github.com/axios/axios#request-config
// axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
// axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
@plcosta
plcosta / postcss.config.js
Created Dec 7, 2018
PostCSS Config - TailwindCSS, Vuetify and PurgeCSS
View postcss.config.js
const tailwindcss = require('tailwindcss')
const autoprefixer = require('autoprefixer')
const purgecss = require('@fullhuman/postcss-purgecss')
module.exports = {
plugins: [
tailwindcss('./tailwind.js'),
autoprefixer({
add: true,
grid: true
@plcosta
plcosta / script.js
Created Jul 31, 2018
Discourse - Custom Categories Topics List
View script.js
<script type='text/x-handlebars' data-template-name='components/latest-topic-list-item'>
<table>
<tbody>
<tr data-topic-id={{topic.id}} class="{{if topic.archived 'archived'}}">
<td class="main-link">
<tr>
{{raw "topic-status" topic=topic}}
{{topic-link topic}}
{{#if topic.featured_link}}
@plcosta
plcosta / routes.rb
Created May 12, 2018
Nested Routes
View routes.rb
resources :courses, except: :show do
resources :chapters, except: :show do
resources :lessons, except: :show do
resources :attachments, except: :show
end
end
end
@plcosta
plcosta / git.md
Created Feb 9, 2018 — forked from twoism-dev/git.md
Hybrid Git Flow
View git.md

Our Git Flow

We are using a simple git flow based on git flow and github flow. We have two branches develop and master.

develop is a representation of staging

master is a representation of production

The Rules

@plcosta
plcosta / query.sql
Last active Sep 14, 2017
Move Discourse Topics from one category to another
View query.sql
-- cd /var/discourse
-- ./launcher enter app
-- su discourse
-- psql
-- MOVE TOPICS CATEGORY
-- CURRENT CATEGORY: 1
-- NEW CATEGORY: 2
UPDATE topics SET category_id = 2 WHERE category_id = 1;
You can’t perform that action at this time.