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
| temp = Tempfile.new(['document_content', '.html']) | |
| temp.write(options[:document_content]) | |
| temp.close | |
| prince_cmd = "docker run --network host -v /var/folders:/var/folders -v #{logfile}:#{logfile} --rm conga/prince prince -v --javascript --log=#{logfile} --baseurl=http://host.docker.internal:3000 #{option_str} #{temp.path} - -o #{outfile.path}" |
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 << self | |
| protected | |
| def gsub_text_nodes_only!(html:, placeholder_name:, placeholder_value:) | |
| fragment = Nokogiri::HTML.fragment(html) | |
| fragment.traverse do |node| | |
| next unless node.text? | |
| # Can't use normal gsub! because it makes a copy of the content memory that is not attached | |
| # to the node. Have to use the setter provided by nokogiri to update the node |
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 Config | |
| attr_accessor :total_threads, :files_per_second, :logger | |
| class << self | |
| def info | |
| @info ||= Config.new | |
| end | |
| 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
| #!/usr/bin/env ruby | |
| require 'fileutils' | |
| require 'tempfile' | |
| # cn = '*.tb.local.vhost' | |
| # server_name = 'dev.tb.local.vhost' | |
| # admin_server_name = 'admin.tb.local.vhost' | |
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
| <table style="width: 100%; height: 304px;"> | |
| <tbody> | |
| <tr style="height: 21px;"> | |
| <th style="width: 50%; height: 21px;">Token Name</th> | |
| <th style="width: 50%; height: 21px;">Value</th> | |
| </tr> | |
| <tr style="height: 21px;"> | |
| <td style="width: 50%; height: 21px;">Proposal Title</td> | |
| <td style="width: 50%; height: 21px;"><span allowstyling="true" data-name="proposal_title" data-type="string" | |
| data-variable-content="inline" data-source="" data-raw-value="Cy Kosis" class="inline-variable mceNonEditable" |
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 'fileutils' | |
| require 'rubygems' | |
| require 'rubygems/gem_runner' | |
| require 'rubygems/exceptions' | |
| require File.expand_path('./logger', __dir__).to_s | |
| ENV['GEM_HOME'] = File.expand_path('gems', __dir__).to_s | |
| FileUtils.mkdir_p(ENV['GEM_HOME']) | |
| ENV['GEM_PATH'] = "#{ENV['GEM_HOME']}:/var/lib/ruby/gems/1.8" | |
| Gem.clear_paths |
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
| s3 = S3Util.new | |
| s3.bucket.objects.each do |object| | |
| if s3.bucket.object(object.key).server_side_encryption | |
| puts "Skipping #{object.key}" | |
| next | |
| end | |
| puts "Encrypting #{object.key}" | |
| s3.turn_on_encryption(object.key) | |
| 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
| require 'paperclip_pattern_processor' | |
| processor = PaperclipPatternProcessor.new | |
| Page.find_each do |page| | |
| urls = page.body.scan(/"(https?:\/\/[\S]+s3.amazonaws.com[\S]+?)"/).flatten.uniq | |
| urls.each do |url| | |
| page.body.gsub!(url, processor.upgrade_url(url)) | |
| end | |
| page.save! | |
| 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
| openssl req -newkey rsa:2048 -x509 -nodes -keyout localhost.key -new -out localhost.crt -subj /CN=\*.tb.local.vhost -reqexts SAN -extensions SAN -days 3650 -config <(cat /System/Library/OpenSSL/openssl.cnf <(printf '[SAN]\nsubjectAltName=DNS:*.tb.local.vhost')) |
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 TestsController < ApplicationController | |
| before_action :set_test, only: [:show, :edit, :update, :destroy] | |
| # GET /tests | |
| # GET /tests.json | |
| def index | |
| @tests = Test.all | |
| end | |
| # GET /tests/1 |