as

‘Warning Bells Going Off’ as NOAA Forecasts Entire Great Barrier Reef at Risk of Coral Bleaching and Death

By Jessica Corbett Common Dreams “This is a wake-up call,” says one Australian marine biologist. “Given sea temperatures usually increase as we get towards March, this is probably conservative.” Delivering yet another “wake-up call” after recent studies have shown that … Continue reading




as

Scientists Warn Crashing Insect Population Puts ‘Planet’s Ecosystems and Survival of Mankind’ at Risk

By Jon Queally Common Dreams “This is the stuff that worries me most. We don’t know what we’re doing, not trying to stop it, [and] with big consequences we don’t really understand.” The first global scientific review of its kind … Continue reading




as

‘A World Without Clouds. Think About That a Minute’: New Study Details Possibility of Devastating Climate Feedback Loop

By Jessica Corbett Common Dreams “We face a stark choice [between] radical, disruptive changes to our physical world or radical, disruptive changes to our political and economic systems to avoid those outcomes.” As people across the globe mobilize to demand … Continue reading




as

‘Coming Mass Extinction’ Caused by Human Destruction Could Wipe Out 1 Million Species, Warns UN Draft Report

By Jessica Corbett Common Dreams Far-reaching global assessment details how humanity is undermining the very foundations of the natural world     On the heels of an Earth Day that featured calls for radical action to address the current “age … Continue reading




as

Climate Change Driving Population Shifts to Urban Areas

By Kristie Auman-Bauer Penn State News Climate change is causing glaciers to shrink, temperatures to rise, and shifts in human migration in parts of the world, according to a Penn State researcher. Brian Thiede, assistant professor of rural sociology, along … Continue reading




as

Human Activity Increasing Rate of Record-Breaking Hot Years

American Geophysical Union (AGU) Press Release A new study finds human-caused global warming is significantly increasing the rate at which hot temperature records are being broken around the world. Global annual temperature records show there were 17 record hot years … Continue reading




as

‘Utterly Terrifying’: Study Affirms Feedback Loop Fears as Surging Antarctica Ice Loss Tripled in Last Five Years

By Jessica Corbett Common Dreams “The most robust study of the ice mass balance of Antarctica to date,” scientists say, “now puts Antarctica in the frame as one of the largest contributors to sea-level rise.” Scientists are expressing alarm over … Continue reading



  • Climate & Climate Change
  • Climate Change ET
  • Antarctic
  • Antarctic ice sheet
  • Antartic ice loss
  • sea level rise

as

‘A World Without Clouds. Think About That a Minute’: New Study Details Possibility of Devastating Climate Feedback Loop

By Jessica Corbett Common Dreams “We face a stark choice [between] radical, disruptive changes to our physical world or radical, disruptive changes to our political and economic systems to avoid those outcomes.” As people across the globe mobilize to demand … Continue reading




as

‘Warning Bells Going Off’ as NOAA Forecasts Entire Great Barrier Reef at Risk of Coral Bleaching and Death

By Jessica Corbett Common Dreams “This is a wake-up call,” says one Australian marine biologist. “Given sea temperatures usually increase as we get towards March, this is probably conservative.” Delivering yet another “wake-up call” after recent studies have shown that … Continue reading




as

After 30 Years Studying Climate, Scientist Declares: “I’ve Never Been as Worried as I Am Today”

By Jake Johnson Common Dreams And colleague says “global warming” no longer strong enough term. “Global heating is technically more correct because we are talking about changes in the energy balance of the planet.” Declaring that after three decades of … Continue reading




as

Scientists Warn Crashing Insect Population Puts ‘Planet’s Ecosystems and Survival of Mankind’ at Risk

By Jon Queally Common Dreams “This is the stuff that worries me most. We don’t know what we’re doing, not trying to stop it, [and] with big consequences we don’t really understand.” The first global scientific review of its kind … Continue reading




as

‘A World Without Clouds. Think About That a Minute’: New Study Details Possibility of Devastating Climate Feedback Loop

By Jessica Corbett Common Dreams “We face a stark choice [between] radical, disruptive changes to our physical world or radical, disruptive changes to our political and economic systems to avoid those outcomes.” As people across the globe mobilize to demand … Continue reading




as

‘Coming Mass Extinction’ Caused by Human Destruction Could Wipe Out 1 Million Species, Warns UN Draft Report

By Jessica Corbett Common Dreams Far-reaching global assessment details how humanity is undermining the very foundations of the natural world     On the heels of an Earth Day that featured calls for radical action to address the current “age … Continue reading





as

The Principle of Least Surprise

Consistency is at the heart of good product design. But consistency is often misinterpreted as making things look or behave the same way. This ignores context and can lead to a foolish consistency. Instead of consistency, designers should adhere to the Principle of Least Surprise.




as

Talking to computers (part 2): VUI as an error recovery system

I take a closer look at some unavoidable challenges to effective speech recognition, and I discuss why you may want to think twice before designing dialogue that is 'conversational' and 'natural'. I also offer five important questions that I think should form the basis of any VUI design kick-off meeting.




as

Usability task scenarios: The beating heart of a usability test

Usability tests are unique. We ask people to do real tasks with the system and watch. As the person completes the task, we watch their behaviour and listen to their stream-of-consciousness narrative. But what makes a good usability task scenario?




as

Astra Pro with Gutenberg Review – Practical Application

At 3.7 Designs we have an array of strategies we use to solve business problems. For example, when it comes to redesigning a website we might recommend recommend a completely custom design that starts with a design discovery engagement. Typically this process can take three to six months with ample time upfront to research the […]

The post Astra Pro with Gutenberg Review – Practical Application appeared first on Psychology of Web Design | 3.7 Blog.




as

Why personas are antiquated (and what you should use instead)

Personas are antiquated… this coming from someone who has relied on and written about them for years. For years at 3.7 Designs, we’ve created personas during the design discovery phase. I recently realized that the traditional marketing persona is no longer a relevant practice. The keyword here is “traditional.” At 3.7 we’ve adopted a practice […]

The post Why personas are antiquated (and what you should use instead) appeared first on Psychology of Web Design | 3.7 Blog.




as

Designer Spotlight: Burnt Toast

Designer Spotlight: Burnt Toast

abduzeedoMay 07, 2020

Times are definitely changing, we all live in a pandemic and hopefully soon a post-pandemic reality. Economically things will be difficult initially but eventually things will get better. I know this sounds super grim, but in order to help everyone to promote their work, we will start featuring designers from all over the world in a series we call Designer Spotlight. For this one brings to you the amazing work of Burnt Toast.

Burnt Toast Creative is the working alias for Canadian illustrator, Scott Martin. For more information make sure to check out:

Designer Spotlight




as

Abelardo Morell, Camera Obscura: Early Morning View of the East Side of Midtown Manhattan

Abelardo Morell
Camera Obscura: Early Morning View of the East Side of Midtown Manhattan, , 2014
Website - AbelardoMorell.net

Abelardo Morell was born in Havana, Cuba in 1948. He immigrated to the United States with his parents in 1962. Morell received his undergraduate degree in 1977 from Bowdoin College and an MFA from The Yale University School of Art in 1981. In 1997 he received an honorary degree from Bowdoin College.

His publications include a photographic illustration of Alice’s Adventures in Wonderland (1998) by Dutton Children’s Books, A Camera in a Room (1995) by Smithsonian Press, A Book of Books (2002) and Camera Obscura (2004) by Bulfinch Press and Abelardo Morell (2005), published by Phaidon Press. Recent publications include a limited edition book by The Museum of Modern Art in New York of his Cliché Verre images with a text by Oliver Sacks.

His work has been collected and shown in many galleries, institutions and museums, including the Museum of Modern Art, The Whitney Museum of American Art, the Metropolitan Art Museum in New York, The Chicago Art Institute, The San Francisco Museum of Modern Art, The Houston Museum of Art, The Boston Museum of Fine Art, The Victoria & Albert Museum and over seventy other museums in the United States and abroad. A retrospective of his work organized jointly by the Art Institute of Chicago, The Getty in Los Angeles and The High Museum in Atlanta closed in May 2014 after a year of travel. Abelardo will be having his first show at the Edwynn Houk Gallery in New York opening October 23, 2014 and will run until December 20, 2014 featuring a selection of new pictures.




as

Alaska 2018

For this years fishing trip to Alaska, I opted to upgrade my GoPro to a Panasonic GH-5 with Leica 12-60mm lense package at the local Best Buy. This would then accompany the Mavic drone footage. We had a couple sunny days for flying the drone, but really surprised how good the GH-5 footage turned out […]




as

Christmas




as

At College, Move Beyond the Stigma of Asking for Help After a Brain Injury

If extra time on a test or memory aids can make life easier during college, why not use them? Adam talks about moving past the "stigma" of using disability services and getting the help you need to succeed in college.




as

Every Day A Post of WordPress Tips and Tricks until Christmas!

The time has come and our loyal reader know already our traditional Advents Calendar. For the people who don’t know, […]





as

Website Inspiration: BlurHash

Clear representation of how the product works in the header of the Landing Page for BlurHash. A BlurHash is a compact representation of a placeholder for an image. When integrated they really improves app designs by replacing boring grey boxes with smoother loading images. Full Review




as

Troops to receive Purple Hearts for injuries during Iranian missile barrage on al-Asad airbase in Iraq

There will be Purple Hearts awarded to troops injured during the Jan. 8 Iranian missile barrage on the al-Asad airbase in Iraq, a defense official told Military Times.




as

Children’s Exposure to Secondhand Smoke May Be Vastly Underestimated by Parents

Tel Aviv University Press Release Smoking parents misperceive where and when their kids are exposed to cigarette smoke, Tel Aviv University researchers say Four out of 10 children in the US are exposed to secondhand smoke, according to the American … Continue reading




as

Mobility Pricing Relieves Congestion, Helps People Breathe Easier

By David Suzuki with contributions from Senior Editor Ian Hanington David Suzuki Foundation By 2002, drivers in London, England, were spending as much as half their commuting time stalled in traffic, contributing to much of the city centre’s dangerous particulate … Continue reading




as

GOP Plans to Spend at least $20 million to Combat Voting Rights Lawsuits

The Republican National Committee and President Donald Trump's reelection campaign have doubled their litigation budget to $20 million, Politico reported Thursday. RNC chief of staff Richard Walters told Politico that the GOP is prepared to sue Democrats "into oblivion" by spending "whatever is necessary" to prevail in legal fights against its rivals leading up to the November election.




as

DHS: Secret Service has 11 Current Virus Cases

According to the DHS document, along with the 11 active cases there are 23 members of the Secret Service who have recovered from COVID-19 and an additional 60 employees who are self-quarantining. No details have been provided about which members of the Secret Service are infected or if any have recently been on detail with the president or vice president.




as

The Soulful Art of Persuasion with Jason Harris

As creators and entrepreneurs, getting our ideas out in the world is critical. And today, I have my long time friend Jason Harris in the hot seat to help us with just that. Jason is the founder and CEO of the award winning creative agency Mekanism. He is one of Creativity Mag’s most creative people in business, Top 100 People Who Make Advertising Great and about 52 other awards in the creative space. You’ve certainly seen his work if you’ve watched Superbowl commercials or heard of Peloton, Ben & Jerrys, HBO, and more. He also is one of the people that I look up to as a model of giving back. He donates a huge amount of his time to causes in which he believes and uses his marketing savvy for doing good in the world. I’m super inspired by our conversation today for so many reasons, but here’s handful to whet your palette: Of course we get into his new book The Soulful Art of Persuasion, in which Jason breaks down the art of sharing our ideas in an honest and authentic ways We talk about the ups and downs living life identifying as a professional creator, including the […]

The post The Soulful Art of Persuasion with Jason Harris appeared first on Chase Jarvis Photography.




as

Finding Stillness in a Fast Paced World with Ryan Holiday

Ryan Holiday is described by the New York Times as popularizing stoicism, a philosophy of personal ethics which has been practiced by Kings, presidents, artists, writers, and entrepreneurs. His career started at 19 when he dropped out of college at 19 to work with author Robert Greene. Today, he’s a NYT Bestselling author, with 9 books under his belt, including his latest book: Stillness Is the Key which hit #1 on its first week. In this episode: Stillness isn’t a monk-like existence only reserved for the enlightened. Stillness is the idea of being still in a chaotic world and where our best work will come from. Ryan’s personal habits and process during the creation process to find stillness and it doesn’t include meditation. How to say no and build a practice around managing your time. Enjoy! FOLLOW RYAN: instagram | twitter | website Listen to the Podcast Subscribe   Watch the Episode  This podcast is brought to you by CreativeLive. CreativeLive is the world’s largest hub for online creative education in photo/video, art/design, music/audio, craft/maker, money/life and the ability to make a living in any of those disciplines. They are high quality, highly curated classes taught by the world’s top […]

The post Finding Stillness in a Fast Paced World with Ryan Holiday appeared first on Chase Jarvis Photography.




as

Harmony > Balance with Jason Calacanis

Today we’re going back to San Francisco with myself and Jason Calacanis on stage during my tour stop for my book Creative Calling. Jason is an investor and long time host of the This Week in Startups podcast. And, of course, Jason wastes no time in our conversation. He goes right to the heart of the matter by getting into failure, venture capitol, knowing when to quit, and when to push through. Enjoy! FOLLOW JASON: facebook | twitter | website Listen to the Podcast Subscribe   This podcast is brought to you by CreativeLive. CreativeLive is the world’s largest hub for online creative education in photo/video, art/design, music/audio, craft/maker, money/life and the ability to make a living in any of those disciplines. They are high quality, highly curated classes taught by the world’s top experts — Pulitzer, Oscar, Grammy Award winners, New York Times best selling authors and the best entrepreneurs of our times.

The post Harmony > Balance with Jason Calacanis appeared first on Chase Jarvis Photography.




as

Resilience and Going Untouchable with Neil Pasricha

Neil Pasricha is a bestselling author and podcaster whose work focuses on topics core to all of our lives: gratitude, happiness, failure, resilience, and trust. He’s the author of six books including The Book of Awesome, The Happiness Equation, Awesome Is Everywhere, and his latest book: You Are Awesome.  In this episode: We are too thin skinned. No matter how great our achievements, we’re crushed by the simplest things. Neil shares some practical advice to navigate through pain and build resiliency Always do something you’re learning… Or as I like to say, how to give yourself permission to suck There’s a reason why they call something a “practice”. We get into how to let go and allow yourself to be human. and much more Enjoy! FOLLOW NEIL: twitter | website Listen to the Podcast Subscribe   This podcast is brought to you by CreativeLive. CreativeLive is the world’s largest hub for online creative education in photo/video, art/design, music/audio, craft/maker, money/life and the ability to make a living in any of those disciplines. They are high quality, highly curated classes taught by the world’s top experts — Pulitzer, Oscar, Grammy Award winners, New York Times best selling authors and the best entrepreneurs […]

The post Resilience and Going Untouchable with Neil Pasricha appeared first on Chase Jarvis Photography.




as

You Are Not Your Ego with Cheri Huber and Ashwini Narayanan

Cheri has been a student and teacher of Zen for over 35 years. She is the author of over 20 books on Zen, and founded the Mountain View Zen Center and the Zen Monastery Peace Center. Cheri also founded a non-profit dedicated to transforming lives and ending suffering, Living Compassion, whose primary work is the Africa Vulnerable Children Project in Zambia. Ashwini co-facilitates and creates workshops with Cheri. She runs the operations of the two nonprofits that Cheri founded. Her eclectic background includes degrees in physics, business, and computer science to working in advertising, an investment bank, a social enterprise, and several technology startups in the Silicon Valley. Cheri and Ashwini have co-written multiple books, including their latest Don’t Suffer, Communicate. Today’s episode isn’t just about awareness practice, it’s about a framework for navigating life. A few highlights: Zen isn’t just the practice of keeping things nicely organized, it’s also a spiritual practice largely focused on awareness and where you direct attention. Self-improvement is an endless diss. The very nature of saying we need improvement implies we’re not enough. Cheri and Ashwini share some useful tools to redirect the attention, such as using a recorder to access the wisdom, love, and compassion that is […]

The post You Are Not Your Ego with Cheri Huber and Ashwini Narayanan appeared first on Chase Jarvis Photography.




as

Finding True North with Chelsea Yamase

So many of us are going along on the path that we think we want, only to realize that something is missing. The same was true for today’s guest, Chelsea Yamase (@chelseakauai) who found herself heading into a potential career that was slowly killing her soul. Through a winding path of architecture, graphic design, journalism, and a myriad of side hustles, she found herself faced with the big question: pursue the unconventional life of your dreams or stick to a “real job”. She lept. Today, Chelsea is a sought after model, photographer, influencer and movement enthusiast from Hawaii with a focus on mindful living. She’s been featured in Travel and Leisure, Cosmopolitan, Condé Nast Traveler, to name a few, and and worked with numerous brands such as Canon USA, Adidas, Google, Athleta, GoPro, DJI Global and The National Parks Foundation. In this episode: How to give yourself structure that can help you take a leap into an unconventional lifestyle What can you make with what’s around you? Constraints are a path to creativity and a key gaining new perspectives As money and opportunities come in, how do you stay in alignment with your values and the work you really want […]

The post Finding True North with Chelsea Yamase appeared first on Chase Jarvis Photography.




as

Finding Mastery: A Conversation with Michael Gervais

This week I’m in the hot seat with one of the leading experts in mindset training. Dr. Michael Gervais is a high performance psychologist working in the trenches of high-stakes environments with some of the best in the world. His clients include world record holders, Olympians, internationally acclaimed artists, MVPs from every major sport and Fortune 100 CEOs. Dr. Gervais is also the co-founder of Compete to Create, an educational platform for mindset training. Today I’m on his podcast Finding Mastery which unpacks & decodes each guest’s journey to mastery through mindset skills and practices. If you’ve been a listener for awhile, you’ll know this is one of my favorite topics and something I wholeheartedly credit to unlocking my best work. In this episode: How I learned to trust my intuition Dr. Gervais aptly calls out two journeys to mastery: one of self, and one of craft. I share my perspective on how mastery of craft is a required step to mastering oneself We’re taught that making mistakes is bad so we should avoid them. What we really should be taught is it’s not about avoiding mistakes, it’s about error recovery. and much more… Enjoy! FOLLOW MICHAEL: instagram | twitter […]

The post Finding Mastery: A Conversation with Michael Gervais appeared first on Chase Jarvis Photography.




as

Surviving + Thriving with Jasmine Star

If you missed my conversation with my dear friend photographer + entrepreneur Jasmine Star, we were LIVE on CreativeLive TV. CreativeLiveTV is a brand-new, free, 24/7 variety show, live-streamed from the very casual living rooms, studios, and kitchen tables of our worldwide community of legendary creators.  Worth checking out over at http://creativelive.com/tv. In this episode, we’re coming to you from our living rooms to chat about not just survive in these strange times, but to thrive. In particular, finding, participating, and growing your online community. Enjoy! FOLLOW JASMINE: instagram | twitter | website Listen to the Podcast Subscribe   Watch the Episode This podcast is brought to you by CreativeLive. CreativeLive is the world’s largest hub for online creative education in photo/video, art/design, music/audio, craft/maker, money/life and the ability to make a living in any of those disciplines. They are high quality, highly curated classes taught by the world’s top experts — Pulitzer, Oscar, Grammy Award winners, New York Times best selling authors and the best entrepreneurs of our times.

The post Surviving + Thriving with Jasmine Star appeared first on Chase Jarvis Photography.




as

Markdown Comes Alive! Part 1, Basic Editor

In my last post, I covered what LiveView is at a high level. In this series, we’re going to dive deeper and implement a LiveView powered Markdown editor called Frampton. This series assumes you have some familiarity with Phoenix and Elixir, including having them set up locally. Check out Elizabeth’s three-part series on getting started with Phoenix for a refresher.

This series has a companion repository published on GitHub. Get started by cloning it down and switching to the starter branch. You can see the completed application on master. Our goal today is to make a Markdown editor, which allows a user to enter Markdown text on a page and see it rendered as HTML next to it in real-time. We’ll make use of LiveView for the interaction and the Earmark package for rendering Markdown. The starter branch provides some styles and installs LiveView.

Rendering Markdown

Let’s set aside the LiveView portion and start with our data structures and the functions that operate on them. To begin, a Post will have a body, which holds the rendered HTML string, and title. A string of markdown can be turned into HTML by calling Post.render(post, markdown). I think that just about covers it!

First, let’s define our struct in lib/frampton/post.ex:

defmodule Frampton.Post do
  defstruct body: "", title: ""

  def render(%__MODULE{} = post, markdown) do
    # Fill me in!
  end
end

Now the failing test (in test/frampton/post_test.exs):

describe "render/2" do
  test "returns our post with the body set" do
    markdown = "# Hello world!"                                                                                                                 
    assert Post.render(%Post{}, markdown) == {:ok, %Post{body: "<h1>Hello World</h1>
"}}
  end
end

Our render method will just be a wrapper around Earmark.as_html!/2 that puts the result into the body of the post. Add {:earmark, "~> 1.4.3"} to your deps in mix.exs, run mix deps.get and fill out render function:

def render(%__MODULE{} = post, markdown) do
  html = Earmark.as_html!(markdown)
  {:ok, Map.put(post, :body, html)}
end

Our test should now pass, and we can render posts! [Note: we’re using the as_html! method, which prints error messages instead of passing them back to the user. A smarter version of this would handle any errors and show them to the user. I leave that as an exercise for the reader…] Time to play around with this in an IEx prompt (run iex -S mix in your terminal):

iex(1)> alias Frampton.Post
Frampton.Post
iex(2)> post = %Post{}
%Frampton.Post{body: "", title: ""}
iex(3)> {:ok, updated_post} = Post.render(post, "# Hello world!")
{:ok, %Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}}
iex(4)> updated_post
%Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}

Great! That’s exactly what we’d expect. You can find the final code for this in the render_post branch.

LiveView Editor

Now for the fun part: Editing this live!

First, we’ll need a route for the editor to live at: /editor sounds good to me. LiveViews can be rendered from a controller, or directly in the router. We don’t have any initial state, so let's go straight from a router.

First, let's put up a minimal test. In test/frampton_web/live/editor_live_test.exs:

defmodule FramptonWeb.EditorLiveTest do
  use FramptonWeb.ConnCase
  import Phoenix.LiveViewTest

  test "the editor renders" do
    conn = get(build_conn(), "/editor")
    assert html_response(conn, 200) =~ "data-test="editor""
  end
end

This test doesn’t do much yet, but notice that it isn’t live view specific. Our first render is just the same as any other controller test we’d write. The page’s content is there right from the beginning, without the need to parse JavaScript or make API calls back to the server. Nice.

To make that test pass, add a route to lib/frampton_web/router.ex. First, we import the LiveView code, then we render our Editor:

import Phoenix.LiveView.Router
# … Code skipped ...
# Inside of `scope "/"`:
live "/editor", EditorLive

Now place a minimal EditorLive module, in lib/frampton_web/live/editor_live.ex:

defmodule FramptonWeb.EditorLive do
  use Phoenix.LiveView

  def render(assigns) do
    ~L"""
      <div data-test=”editor”>
        <h1>Hello world!</h1>
      </div>
      """
  end

  def mount(_params, _session, socket) do
    {:ok, socket}
  end
end

And we have a passing test suite! The ~L sigil designates that LiveView should track changes to the content inside. We could keep all of our markup in this render/1 method, but let’s break it out into its own template for demonstration purposes.

Move the contents of render into lib/frampton_web/templates/editor/show.html.leex, and replace EditorLive.render/1 with this one liner: def render(assigns), do: FramptonWeb.EditorView.render("show.html", assigns). And finally, make an EditorView module in lib/frampton_web/views/editor_view.ex:

defmodule FramptonWeb.EditorView do
  use FramptonWeb, :view
  import Phoenix.LiveView
end

Our test should now be passing, and we’ve got a nicely separated out template, view and “live” server. We can keep markup in the template, helper functions in the view, and reactive code on the server. Now let’s move forward to actually render some posts!

Handling User Input

We’ve got four tasks to accomplish before we are done:

  1. Take markdown input from the textarea
  2. Send that input to the LiveServer
  3. Turn that raw markdown into HTML
  4. Return the rendered HTML to the page.

Event binding

To start with, we need to annotate our textarea with an event binding. This tells the liveview.js framework to forward DOM events to the server, using our liveview channel. Open up lib/frampton_web/templates/editor/show.html.leex and annotate our textarea:

<textarea phx-keyup="render_post"></textarea>

This names the event (render_post) and sends it on each keyup. Let’s crack open our web inspector and look at the web socket traffic. Using Chrome, open the developer tools, navigate to the network tab and click WS. In development you’ll see two socket connections: one is Phoenix LiveReload, which polls your filesystem and reloads pages appropriately. The second one is our LiveView connection. If you let it sit for a while, you’ll see that it's emitting a “heartbeat” call. If your server is running, you’ll see that it responds with an “ok” message. This lets LiveView clients know when they've lost connection to the server and respond appropriately.

Now, type some text and watch as it sends down each keystroke. However, you’ll also notice that the server responds with a “phx_error” message and wipes out our entered text. That's because our server doesn’t know how to handle the event yet and is throwing an error. Let's fix that next.

Event handling

We’ll catch the event in our EditorLive module. The LiveView behavior defines a handle_event/3 callback that we need to implement. Open up lib/frampton_web/live/editor_live.ex and key in a basic implementation that lets us catch events:

def handle_event("render_post", params, socket) do
  IO.inspect(params)

  {:noreply, socket}
end

The first argument is the name we gave to our event in the template, the second is the data from that event, and finally the socket we’re currently talking through. Give it a try, typing in a few characters. Look at your running server and you should see a stream of events that look something like this:

There’s our keystrokes! Next, let’s pull out that value and use it to render HTML.

Rendering Markdown

Lets adjust our handle_event to pattern match out the value of the textarea:

def handle_event("render_post", %{"value" => raw}, socket) do

Now that we’ve got the raw markdown string, turning it into HTML is easy thanks to the work we did earlier in our Post module. Fill out the body of the function like this:

{:ok, post} = Post.render(%Post{}, raw)
IO.inspect(post)

If you type into the textarea you should see output that looks something like this:

Perfect! Lastly, it’s time to send that rendered html back to the page.

Returning HTML to the page

In a LiveView template, we can identify bits of dynamic data that will change over time. When they change, LiveView will compare what has changed and send over a diff. In our case, the dynamic content is the post body.

Open up show.html.leex again and modify it like so:

<div class="rendered-output">
  <%= @post.body %>
</div>

Refresh the page and see:

Whoops!

The @post variable will only be available after we put it into the socket’s assigns. Let’s initialize it with a blank post. Open editor_live.ex and modify our mount/3 function:

def mount(_params, _session, socket) do
  post = %Post{}
  {:ok, assign(socket, post: post)}
end

In the future, we could retrieve this from some kind of storage, but for now, let's just create a new one each time the page refreshes. Finally, we need to update the Post struct with user input. Update our event handler like this:

def handle_event("render_post", %{"value" => raw}, %{assigns: %{post: post}} = socket) do
  {:ok, post} = Post.render(post, raw)
  {:noreply, assign(socket, post: post)
end

Let's load up http://localhost:4000/editor and see it in action.

Nope, that's not quite right! Phoenix won’t render this as HTML because it’s unsafe user input. We can get around this (very good and useful) security feature by wrapping our content in a raw/1 call. We don’t have a database and user processes are isolated from each other by Elixir. The worst thing a malicious user could do would be crash their own session, which doesn’t bother me one bit.

Check the edit_posts branch for the final version.

Conclusion

That’s a good place to stop for today. We’ve accomplished a lot! We’ve got a dynamically rendering editor that takes user input, processes it and updates the page. And we haven’t written any JavaScript, which means we don’t have to maintain or update any JavaScript. Our server code is built on the rock-solid foundation of the BEAM virtual machine, giving us a great deal of confidence in its reliability and resilience.

In the next post, we’ll tackle making a shared editor, allowing multiple users to edit the same post. This project will highlight Elixir’s concurrency capabilities and demonstrate how LiveView builds on them to enable some incredible user experiences.



  • Code
  • Back-end Engineering

as

CLI Equivalents for Common MAMP PRO and Sequel Pro Tasks

Working on website front ends I sometimes use MAMP PRO to manage local hosts and Sequel Pro to manage databases. Living primarily in my text editor, a terminal, and a browser window, moving to these click-heavy dedicated apps can feel clunky. Happily, the tasks I have most frequently turned to those apps for —starting and stopping servers, creating new hosts, and importing, exporting, deleting, and creating databases— can be done from the command line.

I still pull up MAMP PRO if I need to change a host's PHP version or work with its other more specialized settings, or Sequel Pro to quickly inspect a database, but for the most part I can stay on the keyboard and in my terminal. Here's how:

Command Line MAMP PRO

You can start and stop MAMP PRO's servers from the command line. You can even do this when the MAMP PRO desktop app isn't open.

Note: MAMP PRO's menu icon will not change color to reflect the running/stopped status when the status is changed via the command line.

  • Start the MAMP PRO servers:
/Applications/MAMP PRO.app/Contents/MacOS/MAMP PRO cmd startServers
  • Stop the MAMP PRO servers:
/Applications/MAMP PRO.app/Contents/MacOS/MAMP PRO cmd stopServers
  • Create a host (replace host_name and root_path):
/Applications/MAMP PRO.app/Contents/MacOS/MAMP PRO cmd createHost host_name root_path

MAMP PRO-friendly Command Line Sequel Pro

Note: if you don't use MAMP PRO, just replace the /Applications/MAMP/Library/bin/mysql with mysql.

In all of the following commands, replace username with your user name (locally this is likely root) and database_name with your database name. The -p (password) flag with no argument will trigger an interactive password prompt. This is more secure than including your password in the command itself (like -pYourPasswordHere). Of course, if you're using the default password root is not particular secure to begin with so you might just do -pYourPasswordHere.

Setting the -h (host) flag to localhost or 127.0.0.1 tells mysql to look at what's on localhost. With the MAMP PRO servers running, that will be the MAMP PRO databases.

# with the MAMP PRO servers running, these are equivalent:
# /Applications/MAMP/Library/bin/mysql -h 127.0.0.1 other_options
# and
# /Applications/MAMP/Library/bin/mysql -h localhost other_options

/Applications/MAMP/Library/bin/mysql mysql_options # enter. opens an interactive mysql session
mysql> some command; # don't forget the semicolon
mysql> exit;
  • Create a local database
# with the MAMP PRO servers running
# replace `username` with your username, which is `root` by default
/Applications/MAMP/Library/bin/mysql -h localhost -u username -p -e "create database database_name"

or

# with the MAMP PRO servers running
# replace `username` (`root` by default) and `database_name`
/Applications/MAMP/Library/bin/mysql -h localhost -u username -p # and then enter
mysql> create database database_name; # don't forget the semicolon
mysql> exit

    MAMP PRO's databases are stored in /Library/Application Support/appsolute/MAMP PRO/db so to confirm that it worked you can

ls /Library/Application Support/appsolute/MAMP PRO/db
# will output the available mysql versions. For example I have
mysql56_2018-11-05_16-25-13     mysql57

# If it isn't clear which one you're after, open the main MAMP PRO and click
# on the MySQL "servers and services" item. In my case it shows "Version: 5.7.26"

# Now look in the relevant MySQL directory
ls /Library/Application Support/appsolute/MAMP PRO/db/mysql57
# the newly created database should be in the list
  • Delete a local database
# with the MAMP PRO servers running
# replace `username` (`root` by default) and `database_name`
/Applications/MAMP/Library/bin/mysql -h localhost -u username -p -e "drop database database_name"
  • Export a dump of a local database. Note that this uses mysqldump not mysql.
# to export an uncompressed file
# replace `username` (`root` by default) and `database_name`
/Applications/MAMP/Library/bin/mysqldump -h localhost -u username -p database_name > the/output/path.sql

# to export a compressed file
# replace `username` (`root` by default) and `database_name`
/Applications/MAMP/Library/bin/mysqldump -h localhost -u username -p database_name | gzip -c > the/output/path.gz

  • Export a local dump from an external database over SSH. Note that this uses mysqldump not mysql.

# replace `ssh-user`, `ssh_host`, `mysql_user`, `database_name`, and the output path

# to end up with an uncompressed file
ssh ssh_user@ssh_host "mysqldump -u mysql_user -p database_name | gzip -c" | gunzip > the/output/path.sql

# to end up with a compressed file
ssh ssh_user@ssh_host "mysqldump -u mysql_user -p database_name | gzip -c" > the/output/path.gz
  • Import a local database dump into a local database
# with the MAMP PRO servers running
# replace `username` (`root` by default) and `database_name`
/Applications/MAMP/Library/bin/mysql -h localhost -u username -p database_name < the/dump/path.sql
  • Import a local database dump into a remote database over SSH. Use care with this one. But if you are doing it with Sequel Pro —maybe you are copying a Craft site's database from a production server to a QA server— you might as well be able to do it on the command line.
ssh ssh_user@ssh_host "mysql -u username -p remote_database_name" < the/local/dump/path.sql


For me, using the command line instead of the MAMP PRO and Sequel Pro GUI means less switching between keyboard and mouse, less opening up GUI features that aren't typically visible on my screen, and generally better DX. Give it a try! And while MAMP Pro's CLI is limited to the essentials, command line mysql of course knows no limits. If there's something else you use Sequel Pro for, you may be able to come up with a mysql CLI equivalent you like even better.



  • Code
  • Front-end Engineering
  • Back-end Engineering

as

Should you use Userbase for your next static site?

During the winter 2020 Pointless Weekend, we built TrailBuddy (working app coming soon). Our team consisted of four developers, two project managers, two front-end developers, a digital-analyst, a UXer, and a designer. In about 48 hours, we took an idea from Jeremy Field’s head to a (mostly) working app. We broke up the project in two parts:. First, a back-end that crunches trail, weather, and soil data. That data is exposed via a GraphQL API for a web app to consume.

While developers built the API, I built a static front end using Next.js. Famously, static front-ends don’t have a database, or a concept of “users.” A bit of functionality I wanted to add was saving favorite trails. I didn’t want to be hacky about it, I needed some way to add users and a database. I knew it’d be hard for the developers to set this up as part of the API, they had their hands full with all the #soil-soil-soil-soil-soil (a slack channel dedicated solely to figuring out our soil data problem—those were plentiful.) I had been looking for an excuse to use Userbase, and this seemed like as good a time as any.

A textbook Userbase use case

“When would I use it?” The Usebase site lists these reasons:

  • If you want to build a web app without writing any backend code.
  • If you never want to see your users' data.
  • If you're tired of dealing with databases.
  • If you want to radically simplify your GDPR compliance.
  • And if you want to keep things really simple.

This was a perfect fit for my problem. I didn’t want to write any more backend code for this. I didn’t want to see our user’s data, I don’t care to know anyone’s favorite trails.* A nice bonus to not having users in our backend was not having to worry about keeping their data safe. We don’t have their data at all, it’s end-to-end encrypted by Userbase. We can offer a reasonable amount of privacy for free (well for the price of using Userbase: $49 a year.) I am not tired of dealing with databases, but I’d rather not. I don’t think anyone doesn’t want to simplify their GDPR compliance. Finally, given our tight timeline I wanted nothing more than to keep things really simple.

A sign up form that I didn't have to write a back-end for

Using Userbase

Userbase can be tried for free, so I set aside thirty minutes or so to do a quick proof of concept to make sure this would work out for us. I made an account and followed their Quickstart. Userbase is a fundamentally easy tool to use, but their quickstart is everything I’d want out of a quickstart:

  • Written in the most vanilla way possible (just HTML and vanilla JS). This means I can adapt it to my needs, in this case React using Next.js
  • Easy to follow, it does the most barebones tour of the functionality you can expect to get out of the SDK (software development kit.) In other words it is quick and it is a start
  • It has a live demo and code samples you can download and run yourself

It didn’t take long after that to integrate Userbase into our app with more help from their great docs. I debated whether to add code samples of what we did here, and I didn’t because any reader would be better off using the great quickstart and docs Userbase provides—they are that clear, and that good. Depending on your use case you’ll need to adapt the examples to your needs, for us the trickiest things were creating a top level authentication context to manage users in the app, and a custom hook to encapsulate all the logic for setting, updating, and deleting favourite trails in the app. Userbase’s SDK worked seamlessly for us.

A log in form that I didn't have to write a back-end for

Is Userbase for you?

Maybe. I am definitely a fan, so much so that this blog post probably reads like an advert. Userbase saved me a ton of time in this project. It reminded me of “The All Powerful Front End Developer” talk by Chris Coyer. I don’t fully subscribe to all the ideas in that talk, but it is nice to have “serverless” tools like Userbase, and all the new JAMstacky things. There are limits to the Userbase serverless experience in terms of scale, and control. Obviously relying on a third party for something always carries some (probably small) risk—it’s worth noting Usebase includes a note on their pricing page that says “You can host it yourself always under your control, or we can run it for you for a full serverless experience”—Still, I wouldn’t hesitate this to use in future projects.

One of the great things about Viget and Pointless Weekend is the opportunity to try new things. For me that was Next.js and Userbase for Trailbuddy. It doesn’t always work out (in fact this is my first pointless weekend where a risk hasn’t blown up in my face) but it is always fun. Getting to try out Userbase and beginning to think about how we may use it in the future made the weekend worthwhile for me, and it made my job on this project much more enjoyable.

*I will write a future post about privacy conscious analytics in TrailBuddy when I’ve figured that out. I am looking into Fathom Analytics for that.



  • Code
  • Front-end Engineering

as

240 Basic Icons Vector Freebie

Flat design is everywhere. Nowadays aesthetics is a lot more simple. No more glossy buttons or gradients background, or what a about the shiny table effect every client asked for?.It is all gone now. In favor of a more “undesigned” look a back to basics trend. Following that idea the guys at your favorite resources …

240 Basic Icons Vector Freebie Read More »




as

Freaky Logo Friday. Logo Mash-Ups

What would happen if the logos of famous brands suddenly wake up in the bed of another? Thats what the new tumblr blog Logo Mashups explores. It makes us think in the in the connections they share and how they are constantly appealing to our consumer mind through the commons grounds of symbology and typography.




as

Five Aspects of a Successful Blog Post

It’s 2018, and traditional marketing concept has shifted. We often hear that content marketing is taking the top and is the future of marketing. While content marketing doesn’t only mean blogging, blog posts on a product, service or about your business, should be a big part of your content marketing strategy. There are vast amounts …

Five Aspects of a Successful Blog Post Read More »




as

Mirage JS Deep Dive: Understanding Mirage JS Models And Associations (Part 1)

Mirage JS is helping simplify modern front-end development by providing the ability for front-end engineers to craft applications without relying on an actual back-end service. In this article, I’ll be taking a framework-agnostic approach to show you Mirage JS models and associations. If you haven’t heard of Mirage JS, you can read my previous article in which I introduce it and also integrate it with the progressive framework Vue.js.




as

Smashing Podcast Episode 15 With Phil Smith: How Can I Build An App In 10 Days?

In this episode of the Smashing Podcast, we’re talking about building apps on a tight timeline. How can you quickly turn around a project to respond to an emerging situation like COVID-19? Drew McLellan talks to Phil Smith to find out. Show Notes CardMedic React Native React Native for Web Expo Apiary Phil’s company amillionmonkeys Phil’s personal blog and Twitter Weekly Update Getting Started With Nuxt Implementing Dark Mode In React Apps Using styled-components How To Succeed In Wireframe Design Mirage JS Deep Dive: Understanding Mirage JS Models And Associations (Part 1) Readability Algorithms Should Be Tools, Not Targets Transcript Drew McLellan: He is director of the full-stack web development studio amillionmonkeys, where he partners with business owners and creative agencies to build digital products that make an impact.




as

Meet SmashingConf Live: Our New Interactive Online Conference

In these strange times when everything is connected, it’s too easy to feel lonely and detached. Yes, everybody is just one message away, but there is always something in the way — deadlines to meet, Slack messages to reply, or urgent PRs to review. Connections need time and space to grow, just like learning, and conferences are a great way to find that time and that space. In fact, with SmashingConfs, we’ve always been trying to create such friendly and inclusive spaces.




as

How To Build A Vue Survey App Using Firebase Authentication And Database

In this tutorial, you’ll be building a Survey App, where we’ll learn to validate our users form data, implement Authentication in Vue, and be able to receive survey data using Vue and Firebase (a BaaS platform). As we build this app, we’ll be learning how to handle form validation for different kinds of data, including reaching out to the backend to check if an email is already taken, even before the user submits the form during sign up.