The Interactive Advertising Bureau (IAB) is a European marketing association which has introduced a standard how advertising can be served to users in line with the General Data Protection Regulation...

...GDPR). This standard is called the TCF 2.0 (Transparency and Consent Framework). If you want to integrate any kind of advertising into a website, chances are the advertising network will...

...Basic.encode_credentials for that, and put its result into the Authorization request header. Request specs For request specs, use the :header option. it 'requires authentication' do get '/' expect(response.status).to...

...username, password) get '/', header: { Authorization: encoded_credentials } expect(response.status).to eq(200) end Controller specs In controller specs, you can put then into request.env['Authorization']. it 'requires authentication' do

stackoverflow.com

...an array, neither JavaScript/ES6+ nor libraries like LoDash offet that natively. Here is a simple function instead that modifies the input array in place. function moveArrayElement(array, element, offset) {

...It was what I needed, but you could easily adjust that. Check the linked StackOverflow post for more information and other implementations...

...MySQL and you know the "error" is okay (e.g. you've executed the same statement at the same time on 2 masters which sync each other), you can skip this...

...error and continue with the replication without having to set up the slave from the ground up. stop slave; set global sql_slave_skip_counter = 1; start slave;

makandra dev
medium.com

...why it’s important to find a way to order and maintain your routes. See: Clean your Rails routes: grouping Sometimes the routes.rb grows very fast and each line adds...

...confusion to it. Maybe it is time for a new approach. The quoted article suggests to split up your routes.rb into small partials to keep it clean. For example you...

makandra dev
github.com

...written in pure Ruby and integrates with Rails applications. It provides features as automatic sizing of dots and lines (the more values, the thinner the graph's elements), custom or...

...predefined themes, different styles (bar, line, dot and many more) and multiple graphs in one chart. Installation In your Gemfile: gem 'rmagick', :require => false gem 'gruff' Then run bundle install...

...entering only http://example.com/). If you want to make a request to that site's web server without actually talking to www.example.com (e.g. because this is a load balancer...

...s address but you want to access one specific machine), you cannot just request machine1.example.com or localhost as the above vhost will redirect your request. When talking HTTP 1.1, your...

How to ignore new files Globally Add the path(s) to your file(s) which you would like to ignore...

stefanjudis.com

Suppose you want to implement a publish/subscribe pattern in your Frontend application to react to data changes and events. First, you might be looking for an event emitter library.

can’t find executable rails for rails-3.2.3 (Gem::Exception) ... one of several...

...things might be wrong. You're using RVM It's possible that you have a system-wide gem executable (like rails) that requires a gem that is not available in...

makandra dev

Besides their default styling properties, HTML elements have a semantic meaning. For example, an h1 tag is usually styled with a larger font and bold, while it denotes "the single...

...single main content of a page nav for sets of navigation links article for independent, self-contained content section for sections like chapters, typically with a heading aside for content...

makandra dev

...your remote database, you might not want it to dump each time you deploy (say, you're experimenting with staging and don't want ten dumps an hour). How to...

...skip dump creation: Capistrano 2 In your Capistrano file: before 'deploy:update_code', 'db:dump' unless fetch(:skip_dump, false) The second parameter of fetch sets a default value if...

makandra dev
relishapp.com

...which they are defined and groups nested within that group, but not parent or sibling groups...

On your local system that only hosts non-critical development data and only you have access to, you can store MySQL's root password in your home directory so you...

...out of the question if there's any confidential data in your databases. Assuming diligent screen-locking, an encrypted hard disk and correct permissions set on your credential file, it...

...like invoices/generated?number=123. This could be your (very careless) controller method: def generated send_file File.join(Rails.root, 'shared', 'invoices', params[:number]) end This allows your users not only to...

...files but also any files your application can read, like this: invoices/generated?number=../../../../../etc/passwd # => send_file '/etc/passwd' You do not want this. In most cases you should prefer a show...

Capistrano automatically logs each (successful) deployment into a file on your application servers. It is located at the root of your server's project folder, i.e. the parent of releases...

...and current, like so: /var/www/your-project$ ls current log releases repo revisions.log <--- here shared Each line in that file contains the deployed branch, commit, release ID, and username (was read from...

smashingmagazine.com

A comprehensive introduction to sending HTML emails. Intro: HTML email: Two words that, when combined, brings tears to a developer’s eyes. If you’re a web developer, it’s...

...in your career, whether you like it or not. Coding HTML email is old school. Think back to 1999, when we called ourselves “webmasters” and used Frontpage, WYSIWYG editors and...

Spreewald's patiently repeats the given block again and again until it either passes or times out. Be careful to give patiently a block that can actually be repeated. E.g...

...the field variable that was defined outside of the block (it's the variable set from the Given block's arguments). Because of this, during the first repetition the value...

stackoverflow.com

...run rake and your code is causing an exception which is not the one shown in your terminal. Rails tries to catch this exception and clean up constants but -- while...

...it's still booting up -- fails on this which causes another exception: rake aborted! cannot remove Object::ClassMethods Running rake with the --trace parameter will give you no love; the...

You can use attribute? as shorthanded version of attribute.present?, except for numeric attributes and associations. Technical Details attribute? is generated for all attributes and not only for boolean...

...These methods are using #query_attribute under the hood. For more details you can see ActiveRecord::AttributeMethods::Query. In most circumstances query_attribute is working like attribute.present?. If your attribute...

Having a unique selector for an element is useful to later select it from JavaScript or to update a fragment with an Unpoly. Haml lets you use square brackets ([]) to...

...with ActiveRecord instances, which have a persisted #id and will hence generate the same selector over multiple renderings of the same view. Example - @users.each do |user| .row[user] = user.name

makandra dev

...the transcluded content before adding it to the DOM. # Directive template: """ """ transclude: true link: (scope, element, attributes, _controller, transclude) -> transclude (content) -> # Do custom stuff element.find('.wrapper').append(content)

...much more you can do with the transclusion function. For an in-depth introduction, see this Guide to Angular Transclusion. Also read the Angular docs on this...

# features/support/database_cleaner.rb DatabaseCleaner.clean_with(:deletion) # clean once, now DatabaseCleaner.strategy = :transaction Cucumber::Rails::Database.javascript_strategy = :deletion Cucumber & Rails 2 The latest available cucumber-rails for Rails 2 automatically uses database...

...off. To have database_cleaner work correctly: Add the attached database_cleaner.rb to features/support/ Make sure features/support/env.rb contains the following lines in this order: # features/support/env.rb require 'features/support/database_cleaner' require 'cucumber/rails/active_record' require 'cucumber/rails/world...

...re looking for is not present, first try upgrading ruby-build. If it's still missing, open a request on the ruby-build issue tracker: https://github.com/sstephenson/ruby-build/issues