Skip to content

Instantly share code, notes, and snippets.

# app/views/posts/show.html.erb
<article id="post-<%= @post.id %>" class="post">
<h1><%= @post.title %></h1>
<%= @post.body %>
<small><%= @post.author %></small>
<section class="comments">
<h2>Comments</h2>
<%= render @post.comments %>
</section>
</article>
@mattbrictson
mattbrictson / Gemfile
Created September 11, 2015 15:55
Using vcr with Minitest + Rails (test unit style)
group :test do
gem "minitest"
gem "vcr"
gem "webmock", "~> 1.15.0"
end
@sokhasen
sokhasen / LICENCE SUBLIME TEXT3
Last active November 1, 2023 13:18
Sublime Text 3.1.1 Serial key build is 3176
## Sublime Text 3.1.1 Serial key build is 3176
—– BEGIN LICENSE —–
sgbteam
Single User License
EA7E-1153259
8891CBB9 F1513E4F 1A3405C1 A865D53F
115F202E 7B91AB2D 0D2A40ED 352B269B
76E84F0B CD69BFC7 59F2DFEF E267328F
215652A3 E88F9D8F 4C38E3BA 5B2DAAE4
@hopsoft
hopsoft / Dockerfile
Last active May 17, 2023 19:58
Dockerize your Rails app
FROM ruby:3.0-alpine
RUN apk add --no-cache --update \
ack \
bash \
build-base \
curl \
git \
htop \
less \
@dorianmariecom
dorianmariecom / generate-certificate.sh
Last active December 4, 2021 07:50
Generate certificate for HTTPS on localhost macOS / Rails / Puma
#!/bin/bash
set -e
echo "> Removing certificate"
sudo security delete-certificate -c localhost || true
echo "> Generating .key"
sudo openssl genrsa -out config/localhost.key 4096
@bradgessler
bradgessler / oauth_google_controller.rb
Last active September 14, 2023 13:57
OAuth Google controller
class OAuth::GoogleAuthorizationsController < ApplicationController
CLIENT_ID = Rails.application.credentials.google.client_id
CLIENT_SECRET = Rails.application.credentials.google.client_secret
SCOPE = "openid email profile"
AUTHORIZATION_URL = URI("https://accounts.google.com/o/oauth2/v2/auth")
TOKEN_URL = URI("https://www.googleapis.com/oauth2/v4/token")
USER_INFO_URL = URI("https://www.googleapis.com/oauth2/v3/userinfo")
before_action :validate_state_token, only: :show