Skip to content

Instantly share code, notes, and snippets.

View BLaurenB's full-sized avatar

Lauren Billington BLaurenB

View GitHub Profile

StimulusJS flow

If you boil it all down, here's the basic flow through the app (with some gotcha's)

When there is a request for a page in a Rails-only app, the controller handles and routes the request, and renders a View. When the DOM is being written, some special Stimulus tags cue the instantiation of an associated Stimulus controller. The DOM also listens for user actions that are attached to some page elements via some other special Stimulus tags. When an event occurs, the associated function is called and runs its code to update the DOM without reloading the page.

So... what are the special tags? Here's a longer breakdown:

  1. A section of html is wrapped in a div with a data-controller tag. (The section that is wrapped should contain all the page elements that you plan to listen to or act upon using that controller). The value corresponds to the name of a StimulusJS controller:

Lazy Loading with HOTwire in Rails Views

If you boil it all down, here is the basic flow through an app, for a single lazy-loaded piece of content. (The whole flow would be repeated for any other piece of lazy loaded content in the app.)

  1. A section of an existing view has a turbo_frame_tag wrapping a piece of place-holding text or functionality (like a spinner or some text). The options passed to the tag include an id and a src. The src is a url for a controller method.
  2. There is a view that contains the 'real' content that will replace the placeholder content. It's not a partial. This is because it must correspond to a controller method of the same name. The whole content in this view is wrapped in a turbo_frame_tag, and the id must match the id in the placeholder tag. There should not be a src declared in this tag. The view, of course, could simply call an existing partial from within the turbo_frame_tag.
  3. The url declared in the src is a route and a controller method that correspond to the view n
Situation: copy Prod data and load it into QA.
Problems:
- 3 servers, all with different cersions fo Postgres. Caused issues trying to load data from 12.x into 10.x. Resolved by using pg_dump and special file locations
- need to copy files from 1 server to another -- used scp command line tool.
- databases had different names and different users. Resolved by making empty db on target server that had same name, same user.
require 'rails_helper'
RSpec.describe Model, type: :model do
describe 'Validations' do
it 'it is invalid without ___' do
expect(Model.new(some_attr: nil)).to_not be_valid
end
it 'it validates presence of some_attr' do
expect(Model.new(some_attr: nil)).to validate_presence_of(:some_attr)
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red

Istio Auth Policy and Mesh Policy Results

Test the behavior of various implementations of mTLS for Auth Policies AND Mesh Policies so that we have the right logic implemented when we determine the config mTLS state for the Details API

Set Up

For testing these scenarios, I installed AspenMesh in a bare cluster without enabling mTls by default (use install/kubernetes/aspenmesh.yaml) but otherwise set it up normally according to the Aspen Mesh and Istio Docs.

I used the Istio setup described here

Follow the setup steps in this doc

//Array Cardio I //////////////////////////////////////////////////////////
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Array Cardio 💪</title>
</head>
<body>
<p><em>Psst: have a look at the JavaScript Console</em> 💁</p>

Hu

Pitch

"Hū" is an app for entrepeneurs which helps them visualize the potential interest of their product or idea (to understand Who may be interested, or even narrow down Who their target market is).

Problem

When an entrepeneur has an idea, their friends and family may be supportive and encouraging of an idea which will be a waste of time and money. It can be difficult for the average American to access basic market insight to determine whether an idea could have financial success. Part of the process in securing funding from an investor is the ability to present data that shows your idea has an active target group and a potential for success.