Skip to content

Instantly share code, notes, and snippets.

@matt-whiteley
matt-whiteley / mime_types_patch.rb
Last active May 28, 2019 09:49
Patch for CVE-2019-5418 where gem version upgrade in rails 4 is not possible due to compatibility issues. This file needs to be added as an initializer. Confirmed working on 4.1.x.
require 'action_dispatch/http/mime_negotiation'
module ActionDispatch
module Http
module MimeNegotiation
def formats
@env["action_dispatch.request.formats"] ||=
if parameters[:format]
Array(Mime[parameters[:format]])
elsif use_accept_header && valid_accept_header
accepts
@matt-whiteley
matt-whiteley / selectize_no_results.js
Last active July 18, 2017 18:26 — forked from mudassir0909/selectize_no_results.js
A hacky plugin to display "No results found" message on selectize. Don't use this along with "dropdown_header" plugin though.
/*
https://github.com/brianreavis/selectize.js/issues/470
Selectize doesn't display anything to let the user know there are no results.
This is a temporary patch to display a no results option when there are no
options to select for the user.
*/
Selectize.define( 'no_results', function( options ) {
var self = this;