Skip to content

Instantly share code, notes, and snippets.

View ramonsantos's full-sized avatar
⚒️

Ramon Santos ramonsantos

⚒️
View GitHub Profile
@rodrigoborgesdeoliveira
rodrigoborgesdeoliveira / addBlankSpaceAfterLastItem.java
Last active May 23, 2023 12:42
This shows or hides a floating action button when the recycler view is scrolled. It also adds a blank space after the list's last item to make sure that if the list is too short to be scrolled, it'll still be scrollable to hide the floating action button that is sitting on top of the last item.
// This code is inside the recycler view adapter class
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
if (position + 1 == getItemCount()) {
// It is the last item of the list
// Set bottom margin to 72dp
setBottomMargin(holder.itemView, (int) (72 * Resources.getSystem().getDisplayMetrics().density));
} else {
// Reset bottom margin back to zero
@480
480 / gist:3b41f449686a089f34edb45d00672f28
Last active July 3, 2024 03:59
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@kelvinst
kelvinst / create-ruby-gem.md
Last active November 29, 2023 02:04
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!

@rubencaro
rubencaro / install_elixir.md
Last active September 30, 2023 03:58
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

@pyk
pyk / active-record-migration-expert.md
Last active August 2, 2021 09:20
become active record migration expert (Rails 4.0.2)

become active record migration expert (Rails 4.0.2)

workflow:

create model

$ rails g model NameOfModel
    invoke  active_record
    create    db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb
@tcnksm
tcnksm / exception_spec.rb
Created November 12, 2013 08:20
How to stub raising exceptions in rspec
class Foo
class << self
def exec
something
rescue => ex
ex.message
end
def something
"something"
@rxaviers
rxaviers / gist:7360908
Last active July 3, 2024 09:10
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:
@KINGSABRI
KINGSABRI / terminal_size.rb
Last active March 17, 2023 05:14
Getting Terminal size by ruby
# Here are many ways to get terminal size from ruby
# By Readline
require 'readline'
Readline.get_screen_size #=> [31, 268]
# Get terminal size in Environemtn like IRB
[ENV['COLUMNS'].to_i, ENV['LINES'].to_i]
@jewelsea
jewelsea / Gettysburg.java
Created May 30, 2012 18:59
JavaFX sample to display the Gettysburg address in a titled border.
import javafx.animation.FadeTransition;
import javafx.application.Application;
import javafx.beans.value.*;
import javafx.event.*;
import javafx.geometry.*;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.effect.*;
import javafx.scene.image.*;