The Ransack gem provides us with a powerful, flexible, easy-to-integrate search/filter form.
In your Gemfile, include
gem 'ransack'
| # Installing VIPS | |
| # NOTE: This does not install any PDF handling (but maybe handled through imagemagick?) | |
| sudo yum install fftw libjpeg-turbo-devel libexif-devel giflib-devel libtiff-devel libpng-devel libwebp-devel ImageMagick-devel | |
| sudo yum install meson | |
| sudo yum install cmake | |
| sudo yum install glib2-devel | |
| sudo yum install expat-devel | |
| sudo yum install gobject-introspection-devel | |
| curl -OL https://github.com/libvips/libvips/archive/refs/tags/v8.14.2.zip | |
| unzip v8.14.2.zip |
| #!/usr/bin/env ruby | |
| # | |
| # Find bloating passengers and kill them gracefully. Run from cron every minute. | |
| # | |
| # required for passenger since cron has no environment | |
| ENV['HTTPD'] = 'httpd' | |
| MEM_LIMIT = ARGV[0] || 500 |
| require "uri" | |
| require "time" | |
| require "openssl" | |
| # Calculate v4 AWS sig | |
| class AWSV4Sig | |
| def initialize(access_key, secret_key) | |
| @access_key = access_key | |
| @secret_key = secret_key | |
| end |
| namespace :db do | |
| namespace :migrations do | |
| task :archive do | |
| considered_old = 60 # how many days ago is considered old enough | |
| puts "Looking for migrations older than #{considered_old} days" | |
| db_path = File.join(Rails.root, "db/") | |
| migrations_path = File.join(db_path, "migrate/") | |
| old_migrations_path = File.join(db_path, "old_migrations/") | |
| files = Dir[File.join(migrations_path, "/*.rb")] |
| Rake::Task["db:structure:dump"].enhance do | |
| path = Rails.root.join('db', 'structure.sql') | |
| file = File.read(path) | |
| file.gsub!(/ AUTO_INCREMENT=\d*/, '') | |
| # remove all comment lines | |
| file.gsub!(/^--.*/,'') | |
| File.write(path, file) | |
| end |
| <% form_for(@blog_post) do |f| %> | |
| <%= link_to 'Preview', '#', data: {preview: true, model: @blog_post.class.to_s} %> | |
| <%= f.text_area :body %> | |
| <%= f.submit %> | |
| <% end %> |
| http { | |
| ... | |
| proxy_cache_path /data/perch.squaremill.com/shared/image_cache levels=1:2 keys_zone=images:10m; | |
| ... | |
| } |
| conorhunt:~$ gem install json | |
| Fetching: json-1.5.1.gem (100%) | |
| Building native extensions. This could take a while... | |
| Successfully installed json-1.5.1 | |
| 1 gem installed | |
| conorhunt:~$ irb | |
| rbx-2.0.0pre :001 > require 'json' | |
| TypeError: wrong argument type NilClass (expected Module) | |
| from Rubinius::NativeMethod.load_extension at kernel/common/native_method.rb:43 | |
| from Rubinius::CodeLoader#load_library at kernel/delta/codeloader.rb:180 |
| =INFO REPORT==== 2010-02-16 04:51:40 === | |
| D(<0.199.0>:ejabberd_receiver:320) : Received XML on stream = "<message type=\"chat\" id=\"purple45d00c31\" to=\"[email protected]\" from=\"[email protected]/Adium18999378\"><body>fasdf</body><html xmlns=\"http://jabber.org/protocol/xhtml-im\"><body xmlns=\"http://www.w3.org/1999/xhtml\"><span style=\"font-family: Helvetica; font-size: medium; background: #ffffff;\">fasdf</span></body></html><nos:x value=\"disabled\" xmlns:nos=\"google:nosave\"/><arc:record otr=\"false\" xmlns:arc=\"http://jabber.org/protocol/archive\"/></message>" | |
| =INFO REPORT==== 2010-02-16 04:51:40 === | |
| D(<0.199.0>:shaper:61) : State: {maxrate,50000,193.68630641370012, | |
| 1266295899126721}, Size=455 | |
| M=4.558829829111692, I=1420.107 | |
| =INFO REPORT==== 2010-02-16 04:51:40 === |