This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = File.new("recome.txt", 'w') | |
f << Recommendation.last.primary_plan_cost | |
f.close |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Spree | |
class TaxonHeaderImage < Asset | |
module Configuration | |
module Paperclip | |
extend ActiveSupport::Concern | |
included do | |
def self.styles | |
attachment_definitions[:attachment][:styles] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Spree | |
class TaxonHeaderImage < Asset | |
include Rails.application.config.use_paperclip ? Configuration::Paperclip : Configuration::ActiveStorage | |
include Rails.application.routes.url_helpers | |
def styles | |
self.class.styles.map do |_, size| | |
width, height = size[/(\d+)x(\d+)/].split('x') | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationMailbox < ActionMailbox::Base | |
routing ->(inbound_email) { with_sku?(inbound_email) } => :price_finder | |
def self.with_sku?(inbound_email) | |
inbound_email.mail.subject.include?('SKU') || inbound_email.mail.body.include?('SKU') | |
end | |
end | |
class PriceFinderMailbox < ApplicationMailbox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationMailbox < ActionMailbox::Base | |
# Any of the recipients of the mail (whether to, cc, bcc) are matched against the regexp. | |
routing /^replies@/i => :replies | |
# Any of the recipients of the mail (whether to, cc, bcc) needs to be an exact match for the string. | |
routing "[email protected]" => :help | |
# Any inbound_email that has not been already matched will be sent to the BackstopMailbox. | |
routing :all => :backstop | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ahoy::Store < Ahoy::DatabaseStore | |
def track_visit(data) | |
data[:accept_language] = request.headers["Accept-Language"] | |
super(data) | |
end | |
def track_event(data) | |
data[:properties] = { key: 'value' } | |
super(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.5.1 :006 > Ahoy::Visit.first | |
Ahoy::Visit Load (1.1ms) SELECT "ahoy_visits".* FROM "ahoy_visits" ORDER BY "ahoy_visits"."id" DESC LIMIT $1 [["LIMIT", 1]] | |
=> #<Ahoy::Visit id: 1, visit_token: "d1dec227-ecd8-4052-bd45-ba7f5ac162b8", visitor_token: "76afdd83-5dc8-43a6-8dc8-21bf43ae247b", | |
user_id: nil, ip: "127.0.0.1", user_agent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36...", referrer: nil, | |
referring_domain: nil, landing_page: "http://localhost:3000/", browser: "Chrome", os: "GNU/Linux", device_type: "Desktop", | |
country: nil, region: nil, city: nil, utm_source: nil, utm_medium: nil, utm_term: nil, utm_content: nil, utm_campaign: nil, | |
started_at: "2018-06-03 14:23:49"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mina/bundler' | |
require 'mina/rails' | |
require 'mina/git' | |
require 'mina/rbenv' | |
set :repository, '[email protected]:sanjayprajapati/your-app.git' | |
set :user, 'deploy' | |
set :deploy_to, '/home/deploy/your-app-name' | |
set :branch, 'develop' | |
set :domain, YOUR_SERVER_IP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://github.com/thomasjbradley/signature-pad for more details | |
instructions = JSON.load(data).map { |h| "line #{h['mx']},#{h['my']} #{h['lx']},#{h['ly']}" } * ' ' | |
system "convert -size 198x55 xc:transparent -stroke blue -draw '#{instructions}' signature.png" |
NewerOlder