First, add pry-rails to your Gemfile:
https://github.com/rweng/pry-rails
gem 'pry-rails', group: :developmentThen you'll want to rebuild your Docker container to install the gems
| FROM python:3.7-alpine | |
| EXPOSE 8000 | |
| WORKDIR /app | |
| COPY . . | |
| RUN apk add --update --no-cache --virtual .build-deps \ | |
| g++ \ | |
| python-dev \ | |
| libxml2 \ | |
| libxml2-dev && \ |
| // iOS 11.3 Safari / macOS Safari 11.1 empty <input type="file"> XHR bug workaround. | |
| // This should work with every modern browser which supports ES5 (including IE9). | |
| // https://stackoverflow.com/questions/49614091/safari-11-1-ajax-xhr-form-submission-fails-when-inputtype-file-is-empty | |
| // https://github.com/rails/rails/issues/32440 | |
| document.addEventListener('ajax:before', function(e) { | |
| var inputs = e.target.querySelectorAll('input[type="file"]:not([disabled])') | |
| inputs.forEach(function(input) { | |
| if (input.files.length > 0) return | |
| input.setAttribute('data-safari-temp-disabled', 'true') |
| // Fix for validations on simple form | |
| // Need to import bootstrap functions and mixins if you want to dynamically set colors | |
| // Otherwise replace theme-color... with hex color | |
| @import 'bootstrap/functions'; | |
| @import 'bootstrap/variables'; | |
| @import 'bootstrap/mixins'; | |
| .has-invalid { | |
| .invalid-feedback { |
First, add pry-rails to your Gemfile:
https://github.com/rweng/pry-rails
gem 'pry-rails', group: :developmentThen you'll want to rebuild your Docker container to install the gems
Fast/efficient approach:
-- execute("UPDATE posts SET comments_count = (SELECT count(1) FROM comments WHERE comments.post_id = posts.id)")
-> 1.3197s
Slow/naïve approach:
| <?php | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.com | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
| * Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
| */ | |
| $args = array( |
| #!/usr/bin/env ruby | |
| # List all keys stored in memcache. | |
| # Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
| require 'net/telnet' | |
| headings = %w(id expires bytes cache_key) | |
| rows = [] |