In Capistrano 2, directories in shared_children used to be symlinked to the shared directory during the finalize_update task. # /lib/capistrano/recipes/deploy.rb _cset :shared_children, %w(public/system log tmp/pids) # ... task :finalize...
...update, :except => { :no_release => true } do # ... shared_children.map do |d| run "ln -s #{shared_path}/#{d.split('/').last} #{latest_release}/#{d}" # <-- symlinks only the last segment here end # ... end This would symlink...
You can hook into Slack when using Capistrano for deployment. The slackistrano gem does most of the heavy lifting for you. Its default messages are unobtrusive and can be adjusted...
When deploying, it posts to a Slack channel like this: How to integrate Integrating Slackistrano with Capistrano 3 is fairly simple. In your Slack, open menu → Administration → Manage apps...
...could also use Haml instead. Example Consider the following helper. def greeting message = ''.html_safe message << 'Welcome to ' message << content_tag(:span, Rails.env, class: 'greeting--location') content_tag :div, message...
...That looks clumsy and is hard to read. Wouldn't it be nicer to say something like this? def greeting render_haml <<-HAML .greeting Welcome to %span.greeting--location = Rails.env
...the kind of query). It may help to understand youtube's domain model before starting. It's best to just try out your requests in the browser to see what...
...key in order to make this request work): https://www.googleapis.com/youtube/v3/playlistItems?playlistId= &key= A&part=snippet&fields=nextPageToken,items(snippet(publishedAt,resourceId(videoId))) There are more examples and explanations in the...
...that whenever you are using those values for database interaction, you'll end up scoping on the wrong records since the database representation of these dates is not converted to...
Use form models to handle this problem Or soften the validation to validates_presence_of :parent Usually you would validate presence of parent object id, like in this...
validates_presence_of :parent_id # <- end With the parent already persisted creating nesteds still works fine. But one will encounter a 'parent id missing' error on creating a parent...
...You can add other AWS account depending files like .fog or .guignol.yml too. Create symlinks for some config files like .aws_credentials and .fog: ln -s ~/.aws/.aws_credentials ~/.aws_credentials
...export EC2_CERT=~/.aws/cert-ec2.pem export AWS_CREDENTIAL_FILE=~/.aws/aws-credentials Perhaps you also want to set a default region and the JAVA_HOME: export EC2_REGION=eu-west-1
Say you have an RGBA color that you need as a non-transparent color because of reasons. Basically, this is possible. Just understand that you will convert your RGBA color...
...your background is white, so you'll use #fff as that for examples below. Simple approach When your know the RGBA color's base RGB color (e.g. your brand color...
In specs, the session never persists but is always a new object for each request. Data put into the session in a previous request is lost. Here is how to...
...circumvent that. What's going on? You are making ActionController::TestRequests in your specs, and their #initialize method does this: self.session = TestSession.new This means that each time you say something...
track down warnings and to see failing specs immediately or to get an overview of the core functionalities, you can use RSpec's "nested" format. It looks...
Tool validations should require model to be set should require place_id to be set #identifier should include the model and tag if the tool has a tag...
Barby is a great Ruby gem to generate barcodes of all different sorts. It includes support for QR codes via rQRCode; if you need to render only QR codes, you...
>> Barby::Code128.new('Hello Universe').to_image.to_data_url => "data:image/png;base64,iVBORw0KGgoAA..." For super-crisp barcodes, render them as SVG. Printing images usually causes some level of blur...
...should), the host's IP address is: 10.0.2.2 You'll need it to access shared folders or your host's web server when testing pages in IE.
When you need to check a value for presence, don't rely on JavaScript since it considers 0 or "0" false. Also don't rely on LoDash's _.isEmpty:
While the name implies that it's meant only for collections, you probably still want something like isBlank or isPresent that return true/false for objects humans would normally consider...
Accessing pseudo elements via JavaScript or jQuery is often painful/impossible. However, accessing their styles is fairly simple. Using getComputedStyle First, find the element in question. let element = document.querySelector('.my-element...
...s getComputedStyle. It takes an optional 2nd argument to filter for pseudo elements. let style = window.getComputedStyle(element, '::before') let color = style.getPropertyValue('background-color') The returned color will be a string...
...up little more than one extra line in the output of ps. On a server I want to get informed if there are zombie processes and track them with a...
...two choices, fix it or kill it. In this case it's no critical service and I can just restart it...
There are several ways to merge two (or more) PDF files to a single file using the Linux command line. If you're looking for graphical tools to edit or...
...annotate a PDF, we have a separate card for that. PDFtk (recommended) PDFtk is a great toolkit for manipulating PDF documents. You may need to install it first (sudo apt...
...context) is run outside of transactions, so data created here will bleed into other specs before(:example) is run before each spec inside it, Generally, you'll want a clean...
...setup for each spec so that they are independent of other specs in the same context. Example Consider this spec: describe User, 'something' do before :context do @user = User.make
When using Savon to connect a SOAP API, you may want to use Savon::SpecHelper to mock requests in your tests as described in their documentation. When sending a message...
...body, the savon mock object requires a message to be set, like this: savon.expects(:action_name).with(message: { user_id: 123 }).returns(' ') If you want to stub only the returned...
...run our end-to-end tests with headless Chrome. While it's a very stable solution overall, we sometimes see the headless Chrome process freeze (or the Capybara driver losing...
...connection, we're not sure). The effect is that your test suite suddenly stops progressing without an error. You will eventually see an error after a long timeout but until...
Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox sudo apt install mysql-sandbox Download the version of MySQL...
...you want to use from mysql.com: https://dev.mysql.com/downloads/file/?id=480427 Make sure to choose "Generic Linux" instead of "Ubuntu" so you get a .tar.gz instead of .deb cd into the directory...
...require 'mathn' 2 / 3 => Rational(2,3) 2 / 3 * 3 => 2 While this might sometimes be quite neat, it's a nightmare if this gets required by some gem that...
...suddenly redefines integer division across your whole project. Known culprits are the otherwise excellent distribution and GetText gems (the later only when working with mo-files). To fix this, you...
...take a long time, so we only want to compile when needed. This card shows what will cause Webpacker (the Rails/Webpack integration) to compile your assets. When you run a...
While development it is recommended to boot a webpack dev server using bin/webpack-dev-server. The dev server compiles once when booted. When you access your page on localhost before...
...nested projects. Then it's really helpful! This makes use of the CDPATH variable. Similar to the PATH variable, which holds the list of directories which are searched for executables...
Then add the following to your ~/.bashrc: export CDPATH=.:~/.bookmarks/ function mark { ln -sr "$(pwd)" ~/.bookmarks/"$1" } # Always resolve symbolic links (e.g. for bookmarks) alias cd="cd -P"
When using custom properties in your stylesheets, you may want to set a specific property value to an existing variable in your SASS environment. A pratical example would be a...
...existing quotes, you may use the meta.inspect() function: @use "sass:meta" $my-cool-font: "Roboto", sans-serif :root --font-family-sans-serif: #{meta.inspect($my-cool-font)} Unfortunately, the output of...