Skip to content

Instantly share code, notes, and snippets.

View souzagab's full-sized avatar
:shipit:

Gabriel S. souzagab

:shipit:
View GitHub Profile
@freeformz
freeformz / WhyILikeGo.md
Last active October 6, 2022 23:31
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.

@jwg2s
jwg2s / spec.rb
Last active December 18, 2021 14:26
No Focus Trues in Source
it 'should ensure we have no extra focus true exist' do
files = Dir.glob(File.join(Rails.root, 'spec', '**', '*_spec.rb'))
count = 0
files.each do |file|
unless File.readlines(file).grep(/focus['"]?\s*[\:=][>]?\s*true/).empty?
puts "#{file} has focus true!"
count = count + 1
end
end
count.should == 0
@Chaser324
Chaser324 / GitHub-Forking.md
Last active May 13, 2024 11:18
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@kelvinst
kelvinst / ruby-meta.md
Last active August 7, 2023 20:49
Metaprogramanção em ruby - o básico

Metaprogramanção em ruby - o básico

Bem, se você é um programador há algum tempo já deve ter ouvido falar sobre metaprogramação. Eu sei, dá três tipos de arrepio só de ouvir o termo. E sim, é uma coisa bem cabeluda, é um recurso muito poderoso e muitas vezes difícil de entender. Mas agora seus problemas acabaram 👍 👍! Vou explicar pra vocês o que é metaprogramação e como fazer isso em ruby!

O que é?

Certo, sobre o termo e o conceito então: metaprogramação é um termo usado para definir um programa, ou uma rotina, que manipula o próprio programa (ou outro, tanto faz) em tempo de execução. Ou seja, um programa que programa. É basicamente um código que permite alterar e criar mais código ao ser executado.

Se você pensar bem sobre esta teoria é bem fácil elencar um metaprograma certo? Consegue adivinhar um tipo de metaprograma que você usa no seu dia a dia? Isso mesmo! Compiladores são metaprogramas! Você deve estar pensando: "Ah, mas um compilar não altera o próprio código, ele só gera nov

@mdang
mdang / RAILS_CHEATSHEET.md
Last active May 13, 2024 14:04
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@cdesch
cdesch / rails_generator_cheat_sheet.md
Last active May 15, 2024 13:40
Rails Generator CheatSheet

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

@blackgate
blackgate / mbp2011-disable-amd-gpu.md
Last active November 22, 2023 01:23
Macbook Pro 2011 - Disable AMD GPU
@dommmel
dommmel / blob_authenticatable.rb
Last active July 12, 2023 01:01
Devise authentication for Rails' ActiveStorage
# Rails controller concern to enable Devise authentication for ActiveStorage.
# Put it in +app/controllers/concerns/blob_authenticatable.rb+ and include it when overriding
# +ActiveStorage::BlobsController+ and +ActiveStorage::RepresentationsController+.
#
# Optional configuration:
#
# Set the model that includes devise's database_authenticatable.
# Defaults to Devise.default_scope which defaults to the first
# devise role declared in your routes (usually :user)
#
@maxivak
maxivak / webpacker_rails.md
Last active April 13, 2023 18:46
Webpack, Yarn, Npm in Rails