Skip to content

Instantly share code, notes, and snippets.

View alissonviegas's full-sized avatar

Alisson Viegas alissonviegas

View GitHub Profile
@thebinarypenguin
thebinarypenguin / colorize.rb
Created June 29, 2012 14:09
A simple function to colorize console output of Ruby scripts using ANSI escape codes.
def colorize(value, color)
case color
when :black then "\e[30m" + value.to_s + "\e[0m"
when :red then "\e[31m" + value.to_s + "\e[0m"
when :green then "\e[32m" + value.to_s + "\e[0m"
when :yellow then "\e[33m" + value.to_s + "\e[0m"
when :blue then "\e[34m" + value.to_s + "\e[0m"
when :magenta then "\e[35m" + value.to_s + "\e[0m"
when :cyan then "\e[36m" + value.to_s + "\e[0m"
when :white then "\e[37m" + value.to_s + "\e[0m"
@rxaviers
rxaviers / gist:7360908
Last active April 29, 2025 17:19
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@JunichiIto
JunichiIto / alias_matchers.md
Last active March 27, 2025 14:04
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@kelvinst
kelvinst / git-aliases.md
Last active April 7, 2024 20:30
Git alias - seja rápido, seja breve!

Git alias - seja rápido, seja breve!

Git freak como sou, precisava compartilhar algo útil sobre ele, claro. E, já que não vejo muito por aí o pessoal usando, resolvi falar dos alias do git! É um recurso que eu uso muito, e nunca entendi porque muitas pessoas não são adeptas. 😕

Pelo nome você já deve perceber que os alias no git são atalhos. Atalhos pro quê? São atalhos para comandos do git e até comandos shell se você quiser. E é bem fácil cadastrar um alias:

$ git config --global alias.st status
@kelvinst
kelvinst / create-ruby-gem.md
Last active March 18, 2025 12:17
Como criar uma gem ruby?

Como criar uma gem ruby?

Escolhi tratar sobre esse assunto hoje simplesmente porque foi uma das primeiras coisas que me perguntei "como eu faço isso?" no mundo ruby. Acredito que muita gente se pergunte a mesma coisa e espero que eu possa ajudar em algo para elas. 😀

O que é uma gem?

Bem, se você é um programador java, você chama sua gem de jar, se você é um programador C#, você chama de dll. Resumindo, é uma lib, uma biblioteca contendo códigos que você pode reaproveitar importando em outros projetos.

E usar gems no ruby é muito fácil, se você já deu uma brincada com rails por exemplo, é só você adicionar o código gem 'nome_da_gem' no arquivo Gemfile que está no root, depois executar o comando bundle install para baixar sua gem do repositório e pronto, só sair usando a biblioteca!

@lawso017
lawso017 / mentionable_trix.js.coffee
Last active November 14, 2024 14:26
@mentions with trix-editor and selectize.js
window.addEventListener "trix-initialize", (e) =>
Utility.TrixMentions.prepare($(e.target))
@mnishiguchi
mnishiguchi / rails_friendly_forwarding.md
Last active April 29, 2024 13:25
Rails, Devise - Friendly forwarding after sign in or log in
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 29, 2025 15:57
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@mrluizandre
mrluizandre / pt-BR.yml
Last active December 30, 2022 06:00
Rails locale file for brazilian portuguese language pt-BR.yml
---
pt-BR:
activerecord:
errors:
messages:
record_invalid: 'A validação falhou: %{errors}'
restrict_dependent_destroy:
has_one: Não é possível excluir o registro pois existe um %{record} dependente
has_many: Não é possível excluir o registro pois existem %{record} dependentes
date:
pt-BR:
simple_form:
"yes": 'Sim'
"no": 'Não'
required:
text: 'obrigatório'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark won't be used.
# html: '<abbr title="required">*</abbr>'