This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdn.paddle.com/paddle/paddle.js"></script> | |
<%= if vendor_id = Application.get_env(:my_app, :paddle)[:vendor_id] do %> | |
<%= if Application.get_env(:my_app, :paddle)[:sandbox] do %> | |
<script type="text/javascript"> | |
Paddle.Environment.set("sandbox"); | |
Paddle.Setup({ vendor: <%= vendor_id %> }); | |
</script> | |
<% else %> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Little script to recompile ElixirLS with the current elixir version. | |
default_version=0.14.5 | |
version=$1 || $default_version | |
elixir_ls_dir=/tmp/elixir_ls | |
set -e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Allows for recording a sequence of keys pressed | |
* and matching against that sequence. | |
* | |
* Taken from the livebook repo and adapted a little bit. | |
*/ | |
export class KeyBuffer { | |
private resetTimeout: number; | |
private buffer: string[] = []; | |
private resetTimeoutId: number | null = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Benvp.Notion.Client.HTTP do | |
alias Benvp.Notion.Schema | |
alias Benvp.Notion.Parser | |
@base_url "https://api.notion.com/v1" | |
@notion_version "2021-08-16" | |
def get_page(id) do | |
case get(@base_url <> "/pages/#{id}") do | |
{:ok, %Finch.Response{status: 200} = res} -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function autocomplete() { | |
return { | |
// ... | |
select() { | |
this.$refs[`item-${this.focus}`]?.click(); | |
this.focusPrev(); | |
}, | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function autocomplete() { | |
return { | |
// ... | |
scrollTo(idx) { | |
this.$refs[`item-${idx}`]?.scrollIntoView(false); | |
}, | |
focusNext() { | |
const nextIndex = this.focus + 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function autocomplete() { | |
return { | |
// ... | |
focus: 0, | |
setFocus(f) { | |
this.focus = f; | |
}, | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle_event("submit", params, socket), do: {:noreply, socket} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle_event("select", %{"id" => id}, socket) do | |
item = Items.get_item(id) | |
selected = Enum.uniq_by([item] ++ socket.assigns.selected, & &1.id) | |
suggestions = filter_selected(socket.assigns.suggestions, selected) | |
socket = | |
assign(socket, | |
selected: selected, | |
suggestions: suggestions | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle_event("suggest", %{"search" => search}, socket) do | |
suggestions = Items.list_items() |> suggest(search) | |
{:noreply, assign(socket, suggestions: suggestions)} | |
end | |
defp suggest(items, search) do | |
Enum.filter(items, fn i -> | |
i.name | |
|> String.downcase() |
NewerOlder