django views map to rais controllers
polls/views.py¶
from django.http import HttpResponse
from .models import Question
| # CyclicRotationSTART | |
| # Rotate an array to the right by a given number of steps. | |
| # https://github.com/Mickey0521/Codility-Python/blob/master/CyclicRotation.py | |
| # https://app.codility.com/programmers/lessons/2-arrays/cyclic_rotation/ | |
| def solution(A, K): | |
| N = len(A) | |
| # Calculate the effective number of rotations K by taking the modulus of K | |
| # with the length of the array N. This is because rotating an array of length N by N positions is equivalent to not rotating it at all. | |
| K = K % N # Handle cases where K > N | |
| return A[-K:] + A[:-K] |
| """ | |
| https://pjoshi15.com/create-typewriter-effect-animation-using-python/ | |
| Create Typewriter Effect Animation Using Python | |
| Typing animation is an eye-catching video effect in today’s times of reels and short videos. In this tutorial, I will teach you how to create a typewriter animation using Python. | |
| Once you know how to implement this animation, you can then use it to create interactive and dynamic presentations, illustrations, and social media content. | |
| Understanding the Typewriter Effect |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Landing Page</title> | |
| <link rel="stylesheet" href="https://unpkg.com/tailwindcss@^3.0.2/dist/tailwind.min.css"> | |
| <script src="https://cdn.tailwindcss.com"></script> |
| 0.00632 18.00 2.310 0 0.5380 6.5750 65.20 4.0900 1 296.0 15.30 396.90 4.98 24.00 | |
| 0.02731 0.00 7.070 0 0.4690 6.4210 78.90 4.9671 2 242.0 17.80 396.90 9.14 21.60 | |
| 0.02729 0.00 7.070 0 0.4690 7.1850 61.10 4.9671 2 242.0 17.80 392.83 4.03 34.70 | |
| 0.03237 0.00 2.180 0 0.4580 6.9980 45.80 6.0622 3 222.0 18.70 394.63 2.94 33.40 | |
| 0.06905 0.00 2.180 0 0.4580 7.1470 54.20 6.0622 3 222.0 18.70 396.90 5.33 36.20 | |
| 0.02985 0.00 2.180 0 0.4580 6.4300 58.70 6.0622 3 222.0 18.70 394.12 5.21 28.70 | |
| 0.08829 12.50 7.870 0 0.5240 6.0120 66.60 5.5605 5 311.0 15.20 395.60 12.43 22.90 | |
| 0.14455 12.50 7.870 0 0.5240 6.1720 96.10 5.9505 5 311.0 15.20 396.90 19.15 27.10 | |
| 0.21124 12.50 7.870 0 0.5240 5.6310 100.00 6.0821 5 311.0 15.20 386.63 29.93 16.50 | |
| 0.17004 12.50 7.870 0 0.5240 6.0040 85.90 6.5921 5 311.0 15.20 386.71 17.10 18.90 |
| https://editorjs.io/ | |
| https://remirror.io/ | |
| https://kuy.io/blog/posts/modern-front-end-magic-with-rails-7-a-visual-editor-for-markdown-part-1 | |
| https://www.rippling.com/blog/building-editors-in-react-applications | |
| from slatejs to tiptap | |
| https://www.ashbyhq.com/blog/engineering/tiptap-part-1 | |
| ### slatejs | |
| https://jkrsp.com/slate-js-placeholder-per-line/ | |
| https://dev.to/devcer/notion-like-placeholders-for-every-line-slatejs-4hoh |
| data-scientist | |
| https://jaidevd.com/posts/code-readability-process/ | |
| ## django tips | |
| https://testdriven.io/blog/django-vs-flask/ | |
| https://github.com/django-extensions/django-extensions | |
| # wsgi | |
| https://www.b-list.org/weblog/2018/feb/22/teenage-django/ | |
| https://www.b-list.org/weblog/2009/aug/10/wsgi/ |
| module Ubiquity | |
| class CrossrefResponse | |
| attr_reader :error, :attributes | |
| def initialize(response_hash = nil) | |
| @error = error | |
| @attributes = response_hash['message'] | |
| end | |
| def title | |
| attributes['title'] |
| module Ubiquity | |
| class ApiSerializer | |
| attr_accessor :data | |
| def initialize (data) | |
| @data ||= data | |
| end | |
| def license_for_api | |
| if data.try(:license).present? | |
| remap_license |