steve lee
Active Storage - some techniques
Requirements
Install ImageMagick or libvips.
Install image_processing gem
1. Get the dimension size of an image
For example, we have a model MediaAsset like this:
class MediaAsset < ApplicationRecord
validates :media_file, presence: true
end
If the blob has been analyzed, you can access the image's dimension by:
media_file = MediaAsset.find(2).media_file
media_file.metadata
# => {"identified"=>true, "analyzed"=>true, "width"=>1000, "height"=>1017}
media_file.metadata["width"] # or height
You must call analyze() method if the blob hasn't been analyzed.
media_file.analyzed…
roogen
Todo/Task management Website using React
Todo/Task management_Website
Todo website that keeps track of everything you need to do, allowing you to focus on what truly matters. empowers you to organize your life with precision and efficiency.
Features
Login/Signup (with jwt and bcrypt)
Add task
Update task
Delete task
screenshots
Tech Stack
Clint: React, React-router-dom, Chakra-UI
Server: Node, Express, MongoDB, JWT
Learn More
To learn more about React Native, take a look at the following resources:
React Native Website – learn more about React Native.
Getting Started – an overview of React Native and how setup your environment…
steve lee
Clojure - a whirlwind tour
Clojure is a functional, dynamic language, a dialect of Lisp that runs on the JVM. Because it is a functional language, it has some aspects we can talk about:
Immutable data
Higher-order function
Anonymous function
Recursive
Lazy evaluation
My first impression is that Clojure exclusively uses prefix notation, instead of infix notation like other popular languages.
For example, to evaluate expression 1 + 2 * 3, we must write:
(+ 1 (* 2 3))
; => 7
All operations in Clojure take the form opening parenthesis, operator, operands, closing parenthesis:
(max 3 5)
; => 5
(println "result is:" (* 2 4…