Skip to content

Instantly share code, notes, and snippets.

View prsanjay's full-sized avatar
🏠
Working from home

Sanjay Prajapati prsanjay

🏠
Working from home
View GitHub Profile
@prsanjay
prsanjay / paperclip.rb
Created June 30, 2019 07:20
Style configuration for taxon header image
module Spree
class TaxonHeaderImage < Asset
module Configuration
module Paperclip
extend ActiveSupport::Concern
included do
def self.styles
attachment_definitions[:attachment][:styles]
end
@prsanjay
prsanjay / console_to_file.rb
Created June 30, 2019 08:07
Copy Rails Console output to the file
f = File.new("recome.txt", 'w')
f << Recommendation.last.primary_plan_cost
f.close
@prsanjay
prsanjay / Dockerfile
Created August 6, 2019 06:38
Dockerfile that install package manually from .deb file
FROM ruby:2.6.1
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash \
&& apt-get update && apt-get install -y nodejs xvfb libfontconfig wkhtmltopdf && rm -rf /var/lib/apt/lists/* \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y yarn && rm -rf /var/lib/apt/lists/*
# Packages for wkhtmltopdf. These are available in ubuntu but not in debian 9. Base image uses debian 9.
RUN wget -q -O /tmp/libjpeg-turbo8.deb http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.1-0ubuntu2_amd64.deb \
&& dpkg -i /tmp/libjpeg-turbo8.deb \