Skip to content

Instantly share code, notes, and snippets.

@mvellandi
mvellandi / gist:2fbaf2a460dbb8a090e0142132af0355
Last active December 20, 2022 19:33
Tailwind Config ---- trying to figure out how to set base font size for typography plugin, using 10px = 1 rem
const defaultTheme = require("tailwindcss/defaultTheme");
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
theme: {
@mvellandi
mvellandi / sample.ndjson
Last active August 18, 2022 07:54
sample ndjson for importing to sanity
{"_type":"post","_createdAt":"datetime","publishedAt":"datetime","title":"title","body":[{"_type":"block","markDefs":[],"style":"normal","children":[{"_type":"img","asset":{"src":"http://weburl","alt":"text"}}]}]}
@mvellandi
mvellandi / Sanity_newcomer_difficulties.md
Last active August 15, 2022 20:05
Sanity difficulties

From my couple months now with Sanity studio, I've noticed that it starts to become tedious to grow and adapt one's projects. We're provided with lots of "lego" pieces with good documentation and various guides. But some important things are missing that I feel would help new platform adopters.

Guidance on Project Architecture

I prefer "convention over configuration". However, I totally understand that everybody's content structuring needs are different. Yet, let me ask: Is there a "Sanity" way of building a project? Setting up a couple declarative schema files with a few UI components, loading them into schema.js, and letting Sanity compile the project accordingly and alert for errors works nicely. But beyond that, it feels like we're completely on our own. Sure, the sample projects (ecommerce, blog, movie) provide some simplistic but valuable examples. The starters also can be good. I wish there were more studio-only examples to review. A community directory of active public studio repos could be helpf

Adolfo Bioy Casares, tr. Ruth L.C. Simms, The Invention of Morel (1940) : 103 pages
John Steinbeck, Of Mice and Men (1937) : 107 pages
George Orwell, Animal Farm (1945) : 112 pages
Sir Arthur Conan Doyle, The Hound of the Baskervilles (1902) : 112 pages
James M. Cain, The Postman Always Rings Twice (1933) : 112 pages
Nella Larsen, Passing (1929) : 122 pages
Albert Camus, tr. Matthew Ward, The Stranger (1942) : 123 pages
Juan Rulfo, tr. Margaret Sayers Peden, Pedro Páramo (1955) : 128 pages
Italo Calvino, tr. Archibald Colquhoun, The Cloven Viscount (1959) : 128 pages
Kate Chopin, The Awakening (1899) : 128 pages
/type/page /about/oregon 3 2008-07-30T16:43:55.392702 {"body": {"type": "/type/text", "value": "http://www.archive.org/details/marc_oregon_summit_records/\r\n\r\n 3585111 records\r\n 3580425 good records\r\n 4686 bad records\r\n\r\nBad records:\r\n\r\nmarc_oregon_summit_records/catalog_files/osu_bibs.mrc:39257417:1974\r\n\r\n> Has a unicode character in the leader, which when read as bytes makes the leader one character too long.\r\n\r\nmarc_oregon_summit_records/catalog_files/pcc_bibs.mrc_rev.mrc:94936119:326\r\n\r\n> Field '020' (ISBN) looks like \"0387945377\", it should be \"$a0387945377\" where $ is the field separator."}, "title": "MARC records from a consortia of Oregon libraries", "last_modified": {"type": "/type/datetime", "value": "2008-07-30T16:43:55.392702"}, "key": "/about/oregon", "type": {"key": "/type/page"}, "revision": 3}
/type/author /authors/OL1000057A 2 2008-08-20T17:57:09.66187 {"name": "Kha\u0304lid Muh\u0323ammad \u02bbAli\u0304 al-H\u0323a
@mvellandi
mvellandi / home.ex
Last active March 10, 2020 17:43
handle_event within LiveComponent error
defmodule EasyTimerWeb.Setup.Home do
use Phoenix.LiveComponent
alias EasyTimerWeb.SetupView
alias Phoenix.View
def render(assigns) do
~L"""
<div>
<%= View.render(SetupView, "home.html", assigns) %>
<p>Timer type: <%= @timer_type %></p>
@mvellandi
mvellandi / gist:8944b07dcac7773ae02656e17fabc935
Created December 11, 2019 21:30
exercism rna_transcription
const DNA_MAP = { G: "C", C: "G", T: "A", A: "U" };
// const RNA_MAP = Object.keys(DNA_MAP).reduce((acc, key) => {
// acc[DNA_MAP[key]] = key;
// return acc;
// }, {});
export const toRna = dna => translateStrand(dna, DNA_MAP);
// export const toDna = rna => translateStrand(rna, RNA_MAP);
@mvellandi
mvellandi / protein_translation.ex
Created November 27, 2019 21:16
Exercism : Elixir : Protein Translation
defmodule ProteinTranslation do
@codon_map %{
cysteine: ["UGU", "UGC"],
leucine: ["UUA", "UUG"],
methionine: ["AUG"],
phenylalanine: ["UUU", "UUC"],
serine: ["UCU", "UCC", "UCA", "UCG"],
tryptophan: ["UGG"],
tyrosine: ["UAU", "UAC"],
stop: ["UAA", "UAG", "UGA"]