Lets create a long list of a million items and look up the 500,000th item
iex(54)> range = 1..1_000_000
1..1000000
iex(55)> index = 500_000
500000| <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 = { |
| 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/ |
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
| 182x182 | |
| 203x203 | |
| 224x224 | |
| 300x94 | |
| 32x32 | |
| 342x108 | |
| 36x36 | |
| 40x40 | |
| 44x44 | |
| 50x50 |
| 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 |
| defmodule Mix.Tasks.CreateSublimeCompletions do | |
| use Mix.Task | |
| @moduledoc """ | |
| Add this mix file to your project, update `@sublime_dir` and run it periodically to | |
| create a Sublime completions file to get fast code completion in Sublime for your Elixir project. | |
| """ | |
| def run(_args) do | |
| create_completions_file() |
| osascript sendEmail.applescript 'hello there you' [email protected] [email protected] [email protected] |
| @doc """ | |
| Truncates the middle of a string | |
| iex> Utils.String.truncate_middle("some really long string that needs truncating", 10) | |
| "some..ting" | |
| iex> Utils.String.truncate_middle("some really long string that needs truncating", 100) | |
| "some really long string that needs truncating" | |
| """ | |
| def truncate_middle(str, count) when is_binary(str) and is_integer(count) do |
| 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"]]') | |
| }) |