Skip to content

Instantly share code, notes, and snippets.

View MatthewLaFalce's full-sized avatar
Turning coffee into code

Matt LaFalce MatthewLaFalce

Turning coffee into code
View GitHub Profile
@MatthewLaFalce
MatthewLaFalce / rails http status codes
Created March 24, 2023 03:47 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@MatthewLaFalce
MatthewLaFalce / sample.sh
Created January 10, 2023 19:11
Fetch commits between tags
# Fetch commits from most recent commit to branch
git log $(git describe --tags --abbrev=0)..HEAD --oneline
# Fetch commits between most recent two tags
git log ^$(git describe --tags $(git rev-list --tags --reverse --max-count=2) --abbrev=0 | xargs) --oneline
@MatthewLaFalce
MatthewLaFalce / format.md
Last active July 17, 2024 14:45
Git commit message convention

Git commit message convention guide

A standard git commit message typically should follow this format:

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

<description>

Type

@MatthewLaFalce
MatthewLaFalce / show.html.erb
Created June 8, 2021 18:56 — forked from davidphasson/show.html.erb
ERB and the case statement
# Doesn't work
<p>
<% case @request.author_hosted %>
<% when "yes" %>
The school <b>has</b> hosted an author before.
<% when "no" %>
The school <b>has not</b> hosted an author before.
<% end %>
</p>
@MatthewLaFalce
MatthewLaFalce / experience.rb
Created April 16, 2021 13:27 — forked from mamantoha/experience.rb
Rails API Filtering and Sorting
# app/models/experience.rb
#
# == Schema Information
#
# Table name: experiences
#
# id :integer not null, primary key
# title :string
# description :text
# created_at :datetime not null
@MatthewLaFalce
MatthewLaFalce / pagination.scss
Last active June 26, 2020 19:05
Custom Pagination Style using the will-paginate gem
.pear_pagination {
text-align: center;
padding: 1em;
cursor: default;
}
.pear_pagination a,
.pear_pagination span {
padding: 0.2em 0.3em;
}
.pear_pagination .disabled {
@MatthewLaFalce
MatthewLaFalce / example.cs
Created April 16, 2020 19:16 — forked from brandonmwest/example.cs
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));

Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

The goal of this cheatsheet is to make it easy to add hand-rolled authentication to any rails app in a series of layers.

First the simplest/core layers, then optional layers depending on which features/functionality you want.

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Ruby on Rails Version 4 or 5
@MatthewLaFalce
MatthewLaFalce / .bash_aliases
Last active February 5, 2020 19:10
Windows Git Bash Configuration Files
#.bash_aliases
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
fi
pushFunc(){