Skip to content

Instantly share code, notes, and snippets.

View vladvinnikov's full-sized avatar

Vladimir Vinnikov vladvinnikov

View GitHub Profile
@alexford
alexford / main.yml
Last active January 7, 2025 06:25
Running Rails tests with RSpec on GitHub actions with Postgres
name: CI
on: [push]
jobs:
rspec:
runs-on: ubuntu-latest
container:
image: ruby:2.6.5
@ArturT
ArturT / main.yaml
Last active November 9, 2022 06:10
GitHub Actions - how to run parallel tests in RSpec for Ruby on Rails project. See article how to run RSpec on GitHub Actions for Ruby on Rails app using parallel jobs https://docs.knapsackpro.com/2019/how-to-run-rspec-on-github-actions-for-ruby-on-rails-app-using-parallel-jobs or sign up at https://knapsackpro.com/?utm_source=github&utm_medium=…
# .github/workflows/main.yaml
name: Main
on: [push]
jobs:
test:
runs-on: ubuntu-latest
# If you need DB like PostgreSQL, Redis then define service below.
@satendra02
satendra02 / app.DockerFile
Last active November 19, 2024 17:28
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
@chunpan
chunpan / auto_truncate_string_column.rb
Last active April 21, 2021 22:17
Ruby Module to Allow Auto Truncation of String Columns using ActiveRecord Callbacks
require 'active_support/core_ext/class/attribute'
require 'active_support/concern'
# This module enables a simple declaration for the including ActiveRecord model
# class to specify one or more columns (attributes) to automatically truncate
# its length to a max value or as defined by the column width in your schema.
#
# Usage example:
#
# class MyModel << ActiveRecord::Base
@kjellm
kjellm / app.rb
Last active July 26, 2021 04:46
Event Source proof of concept. Copyright 2017 Kjell-Magne Øierud. License: MIT https://opensource.org/licenses/MIT
require_relative 'base'
require_relative 'event'
require_relative 'cmd'
require_relative 'crud'
require_relative 'model'
require_relative 'read'
require 'pp'
class Application < BaseObject
@davidpaulhunt
davidpaulhunt / excon_openssl.md
Last active November 6, 2016 09:20
Unable to verify certificate fix re: excon, openssl, and fog

Ran into the excon/openssl error certificate verify failed (OpenSSL::SSL::SSLError) Unable to verify certificate.

After reading through a few posts, trying different solutions, here are the steps that resolved the issue with regards to my particular needs. Final main source at the bottom.

brew doctor
brew update openssl

rvm get stable
rvm install ruby-2.1.9 --with-openssl-dir=`brew --prefix openssl`

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

inherit_from: .rubocop_todo.yml
AllCops:
Exclude:
- 'bin/*'
- 'db/schema.rb'
- 'tmp/**/*'
- 'vendor/**/*'
RunRailsCops: true
Documentation:
Enabled: false
# this is a dirty implementation of logger that
# compiles AR queries with trace into /last_request_log.html
# the snippet is useful when optimizing performance of the endpoint
class QueryLogSubscriber < ActiveSupport::LogSubscriber
TRACE_LEVEL = :app
LINES = 5
IGNORE_CACHED_QUERIES = false
def initialize