Skip to content

Instantly share code, notes, and snippets.

View paderinandrey's full-sized avatar

Andrey Paderin paderinandrey

View GitHub Profile
FROM ruby:2.6.3-slim-buster
SHELL ["/bin/bash", "-c"]
ARG NGINX_VERSION=1.14.2
# Install dependencies
COPY ./ngx_Aptfile /tmp/Aptfile
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
build-essential \
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

class CloneCourse < ActiveJob::Base
def perform(course)
ActiveRecord::Base.transaction do
@new_course = course.dup
@new_course.save!
course.materials.each do |material|
@new_material = material.dup
@new_material.course = @new_course
@new_material.save!