- Open dev tools
- Search for the
<video…
tag. - Copy the source URL
- Right click on the
body
tag and clickEdit as HTML
- Add an a link with the src right inside the body tag like:
<body>
<a href="url-you-copied">download</a>
...
<video…
tag.body
tag and click Edit as HTML
<body>
<a href="url-you-copied">download</a>
...
<video id="player" autoplay muted playsinline> </video> | |
<button id="capture">Capture</button> | |
<canvas id="canvas" width=320 height=240></canvas> | |
<script> | |
const player = document.getElementById('player'); | |
const canvas = document.getElementById('canvas'); | |
const context = canvas.getContext('2d'); | |
const captureButton = document.getElementById('capture'); | |
const constraints = { |
Here's an ecto changeset validation for urls:
@doc """
validates field is a valid url
## Examples
iex> Ecto.Changeset.cast(%ZB.Account{}, %{"website" => "https://www.zipbooks.com"}, [:website])
...> |> Utils.Changeset.validate_url(:website)
...> |> Map.get(:valid?)
I will often run this command to make sure all my docker containers are stopped and removed before running docker-compose up. Sometimes when you restart your system, old containers will start back up automatically in the background.
docker stop $(docker ps -aq) && docker rm $(docker ps -aq)
import UIKit | |
// All you do is assign this class to a segue in your storyboard and you're done | |
class BottomCardSegue: UIStoryboardSegue { | |
private var selfRetainer: BottomCardSegue? = nil | |
override func perform() { | |
destination.transitioningDelegate = self |
import parseCsv from 'zipbooks/utils/parse-csv' | |
import { module, test } from 'qunit' | |
module('Unit | Utility | parse-csv', function(_hooks) { | |
test('parses csv successfully', function(assert) { | |
let result = parseCsv('name,age\nadam,31\ntim,32\n"St, clair",26') | |
assert.equal(JSON.stringify(result), '[["name","age"],["adam","31"],["tim","32"],["St, clair","26"]]') | |
}) |
I have this abstraction in my application code called a "CloudFile". This is where I store in the database information about
files on S3 and it gives me a resource for other resources to own. For example, a user would have an avatar_cloud_file_id
.
On the front-end, I would load this relationship and display the avatar with user.avatar_cloud_file.download_url
defmodule RL.CloudFile do
use Ecto.Schema
import Ecto.Changeset
@timestamps_opts type: :utc_datetime_usec
defmodule Hungarian do | |
@moduledoc """ | |
Written by Adam Kirk – Jan 18, 2020 | |
Most helpful resources used: | |
https://www.youtube.com/watch?v=dQDZNHwuuOY | |
https://www.youtube.com/watch?v=cQ5MsiGaDY8 | |
https://www.geeksforgeeks.org/hungarian-algorithm-assignment-problem-set-1-introduction/ |
INSERT INTO "public"."gis__objects"("id","layer","geometry","properties","inserted_at") | |
VALUES |
defmodule App.Factory do | |
alias App.Repo | |
def create(module, overrides \\ %{}) | |
def create(module, overrides) when is_list(overrides), do: create(module, Map.new(overrides)) | |
def create(module, overrides) do | |
attributes = module.example() |> Map.merge(overrides) | |
struct(module) |