Skip to content

Instantly share code, notes, and snippets.

@dvic
dvic / obsidian-web-clipper.js
Last active April 3, 2024 14:57 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@dvic
dvic / string_field_phoenix_html.exs
Last active August 15, 2023 17:23
demonstrates that you cannot use string fields with phoenix liveview
Application.put_env(:sample, Example.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 5001],
server: true,
live_view: [signing_salt: "aaaaaaaa"],
secret_key_base: String.duplicate("a", 64)
)
Mix.install([
{:plug_cowboy, "~> 2.5"},
{:jason, "~> 1.0"},
@dvic
dvic / access_bug.exs
Created August 15, 2023 12:12
LiveView access form change tracking bug
Application.put_env(:sample, Example.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 5001],
server: true,
live_view: [signing_salt: "aaaaaaaa"],
secret_key_base: String.duplicate("a", 64)
)
Mix.install([
{:plug_cowboy, "~> 2.5"},
{:jason, "~> 1.0"},
@dvic
dvic / hammertime.exs
Created March 29, 2023 16:49
Script demonstrating spear read/write issue
# Setup
Mix.install([
{:jason, "~> 1.4"},
{:spear, "~> 1.3"}
])
connection_string = "esdb://localhost:2113"
stream_name = "tha-stream"
separate_clients = false
@dvic
dvic / aggregate_case.ex
Created November 17, 2022 11:53
an improved aggregate case for commanded
defmodule AggregateCase do
@moduledoc false
use ExUnit.CaseTemplate
alias Commanded.Aggregate.Multi
using opts do
aggregate_module = Keyword.fetch!(opts, :aggregate)
import java.util.*;
public class Solution {
static class Graph {
private final Map<String, Set<String>> adjList = new HashMap<>();
private final Set<String> EMPTY = Collections.unmodifiableSet(new HashSet<String>());
public boolean addEdge(String vFrom, String vTo) {
check(vFrom != null);
check(vTo != null);
@dvic
dvic / gist:6278827
Created August 20, 2013 08:42
Scala cake pattern with Existential Types: compile error
case class Pet(val name: String)
trait ConfigComponent {
type Config
def config: Config
}
trait VetModule extends ConfigComponent {
type Config <: VetModuleConfig