Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[unicef_production_registrations][0]: RemoteTransportException[[Sunset Bain][inet[/172.31.13.218:9300]][indices:data/read/search[phase/query+fetch]]]; nested: SearchParseException[[the-collection][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"function_score\":{\"functions\":[{\"script_score\":{\"script\":\"(0.08 / ((3.16*pow(10,-11)) * abs(now-doc['created'].date.getMillis()) + 0.05)) + 1.0\",\"params\":{\"now\":1429858855000}}}],\"query\":{\"filtered\":{\"query\":{\"multi_match\":{\"query\":\"some name\",\"type\":\"cross_fields\",\"fields\":[\"_all\"],\"operator\":\"or\"}},\"filter\":{\"exists\":{\"field\":\"created\"}}}}}},\"size\":20,\"from\":0}]]]; nested: QueryParsingException[[the-collection] script_score the script could not be loaded]; nested: IllegalArgumentException[Unrecognized method call (d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def http_methods | |
| methods = Array.new | |
| methods << 'GET' if self.http_get | |
| methods << 'POST' if self.http_post | |
| methods << 'PUT' if self.http_put | |
| methods << 'DELETE' if self.http_delete | |
| methods << 'HEAD' if self.http_head | |
| methods | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Encryptor | |
| def encryptor(salt) | |
| ActiveSupport::MessageEncryptor.new(Digest::SHA1.hexdigest(salt + Configuration.encryption_salt)) | |
| end | |
| end | |
| class Thing | |
| include Encryptor | |
| def hash_new_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| before_save :hash_new_key, :if => :key_not_blank? | |
| def key_not_blank? | |
| !self.key.blank? | |
| end | |
| before_save :hash_new_key, :unless => :no_key? | |
| def no_key? | |
| self.key.blank? | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| REGEXP = %r{ | |
| \b | |
| ( | |
| (?: | |
| https?:// | |
| | | |
| www\d{0,3}[.] | |
| | | |
| [a-z0-9.\-]+[.][a-z]{2,4}/ | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2012-03-10T14:15:47+00:00 app[web.1]: Completed 200 OK in 37ms (Views: 29.5ms | ActiveRecord: 0.0ms) | |
| 2012-03-10T14:15:47+00:00 app[web.1]: cache: [GET /berattelser] miss | |
| 2012-03-10T14:15:47+00:00 heroku[router]: GET host/berattelser dyno=web.1 queue=0 wait=0ms service=243ms status=304 bytes=0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function locateMe() { | |
| var supportsLocation = function() { | |
| return 'geolocation' in navigator; | |
| } | |
| var geocoder = new google.maps.Geocoder(); | |
| var onError = function(error) { | |
| console.log(error); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!--[if lt IE 9]> | |
| <link href="stylesheets/ie.css" media="screen" rel="stylesheet" type="text/css" /> | |
| <![endif]--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Payment < ApplicationRecord | |
| end | |
| class PaymentEventMessagesController < ApplicationController | |
| # The controller does as little as possible. Not ethat this should probably verify that the payload is legit somehow | |
| # We offload the heavy lifting to a job to we answer the gateway asap and not bog down our servers | |
| def create | |
| message = PaymentEventMessage.create!(gateway: gateway, payload: params[:payload]) | |
| ProcessPaymentEventMessageJob.perform_later(message.id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app/models/user.rb | |
| class User < ApplicationRecord | |
| attribute :otp_secret, :encrypted | |
| attribute :otp_recovery_secret, :encrypted | |
| end | |
| # lib/types/encrypted_type.rb |