Add to the Devise initializer:
config.send_email_changed_notification = trueUse this PR for attr_encrypted
| require "onnxruntime" | |
| require "mini_magick" | |
| require "numo/narray" | |
| img = MiniMagick::Image.open("images/32576677167_a066c5a7aa_z.jpg") | |
| img.resize "448x448^", "-gravity", "center", "-extent", "448x448" | |
| pixels = Numo::NArray[*img.get_pixels] | |
| pixels = pixels.transpose(2, 0, 1) | |
| pixels = pixels.expand_dims(0) |
| require "onnxruntime" | |
| require "mini_magick" | |
| img = MiniMagick::Image.open("bears.jpg") | |
| pixels = img.get_pixels | |
| model = OnnxRuntime::Model.new("model.onnx") | |
| result = model.predict({"inputs" => [pixels]}) | |
| p result["num_detections"] |
Add to the Devise initializer:
config.send_email_changed_notification = trueUse this PR for attr_encrypted
| #include <stdio.h> | |
| #include <inttypes.h> | |
| #include <math.h> | |
| // Function, which calculates N, p and r from opslimit and memslimit copied from | |
| // libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c | |
| int pickparams(unsigned long long opslimit, const size_t memlimit, | |
| uint32_t *const N_log2, uint32_t *const p, uint32_t *const r) { | |
| unsigned long long maxN; | |
| unsigned long long maxrp; |
| require "bundler/inline" | |
| gemfile do | |
| source "https://rubygems.org" | |
| gem "activerecord", require: "active_record" | |
| gem "activejob", require: "active_job" | |
| gem "sqlite3" | |
| gem "searchkick", git: "https://github.com/ankane/searchkick.git" | |
| end |
Checkout the blog post for the whole story.
Setup Bower and install components:
npm install -g bower
bower installBefore deploying to Heroku, switch to the multi buildpack:
| -- median | |
| -- http://www.postgresonline.com/journal/archives/67-Build-Median-Aggregate-Function-in-SQL.html | |
| CREATE OR REPLACE FUNCTION array_median(numeric[]) | |
| RETURNS numeric AS | |
| $$ | |
| SELECT CASE | |
| WHEN array_upper($1,1) = 0 THEN null | |
| WHEN mod(array_upper($1,1),2) = 1 THEN asorted[ceiling(array_upper(asorted,1)/2.0)] | |
| ELSE ((asorted[ceiling(array_upper(asorted,1)/2.0)] + asorted[ceiling(array_upper(asorted,1)/2.0)+1])/2.0) END |
| = javascript_include_tag "http://maps.googleapis.com/maps/api/js?sensor=false" | |
| #map style="height: 500px;" | |
| javascript: | |
| var pings = #{@pings.to_json(root: false).html_safe}; | |
| $(document).ready( function() { | |
| var mapOptions = { | |
| zoom: 13, |
Because loading gems can take longer than you think
Now available as a gem - get it here