Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View plcosta's full-sized avatar

Pedro Costa plcosta

  • Brazil
  • 06:11 (UTC -03:00)
View GitHub Profile
@plcosta
plcosta / readme.md
Last active March 15, 2021 12:47
Emacs Doom - Shortcuts and Tips

Emacs Shortcuts

All Vim style shortcuts (evil module)

Shortcut Description - Shortcut Description
:w save file - :e + file path open or edit file
:q quit file -
v visual mode
@plcosta
plcosta / Gemfile
Created June 24, 2020 23:26 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@plcosta
plcosta / cpf.fish
Created July 24, 2019 18:56
Brazilian CPF generator - Fish shell function
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 April 10, 2019 13:03
GitLab CI - Review Apps - Example
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 December 19, 2018 23:42
Dynamically update Cloudflare DNS records with the machine's current external IP.
#!/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 December 18, 2018 23:29
Vue.js - Multiple Layouts
<template>
<router-view></router-view>
</template>
<script>
export default {
name: 'App'
}
</script>
@plcosta
plcosta / axios.js
Last active December 14, 2018 13:29
Axios Config
'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 December 7, 2018 00:10
PostCSS Config - TailwindCSS, Vuetify and PurgeCSS
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 July 31, 2018 04:06
Discourse - Custom Categories Topics List
<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 11:39
Nested Routes
resources :courses, except: :show do
resources :chapters, except: :show do
resources :lessons, except: :show do
resources :attachments, except: :show
end
end
end