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
async function getReleaseInfo({ track = "", artist = "" }) { | |
let url = new URL("https://api.discogs.com/database/search"); | |
let searchParams = new URLSearchParams(); | |
searchParams.append("key", process.env.DISCOGS_CONSUMER_KEY); | |
searchParams.append("secret", process.env.DISCOGS_CONSUMER_SECRET); | |
searchParams.append("per_page", 10); | |
if (artist.length) { | |
searchParams.append("artist", artist); | |
} | |
if (track.length) { |
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
// adding one item to an iterator by calling .chain() with an argument that implements IntoIterator | |
pub fn build_proverb(list: &[&str]) -> String { | |
match list.is_empty() { | |
true => String::new(), | |
false => list | |
.windows(2) | |
.map(|window| format!("For want of a {} the {} was lost.", window[0], window[1])) | |
.chain( | |
// first() returns an Option which implements IntoIterator and can be .chain()ed to an other iterator | |
list.first() |
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
use std::cmp::Ordering; | |
#[derive(Debug, PartialEq)] | |
pub enum Comparison { | |
Equal, | |
Sublist, | |
Superlist, | |
Unequal, | |
} |
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
const validOptions = ["corgi", "beagle", "dachshund"]; | |
const string1 = "The labrador jumped"; | |
const string2 = "The corgi jumped"; | |
validOptions.some((option) => string1.includes(option)); // false | |
validOptions.some((option) => string2.includes(option)); // true |
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
/** @jsx jsx */ | |
import React from "react"; | |
import TeX from "@matejmazur/react-katex"; | |
import { jsx } from "theme-ui"; | |
const CodeBlock: React.FC<IProps> = ({ | |
children, | |
title, | |
...props | |
}) => { |
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
[ | |
{ | |
"key": "ctrl+shift+`", | |
"command": "terminal.focus", | |
"when": "!terminalFocus" | |
}, | |
{ | |
"key": "ctrl+shift+`", | |
"command": "workbench.action.focusActiveEditorGroup", | |
"when": "terminalFocus" |
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
const LIKE_FN_NAME = "getTurtleVideo"; | |
const anObject = { | |
[LIKE_FN_NAME]() { | |
return "https://youtu.be/CMNry4PE93Y"; | |
}, | |
}; | |
anObject[LIKE_FN_NAME](); |
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
<template> | |
<time v-bind:datetime="dateObject | toISODate"> | |
{{ dateObject | toPrettyDate }} | |
</time> | |
</template> | |
<script> | |
export default { | |
data() { | |
return { |
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
<template> | |
<!-- 42 is a string --> | |
<Everything answer="42"></Everything> | |
<!-- 42 is a number --> | |
<Everything :answer="42"></Everything> | |
</template> |
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
<template> | |
<!-- pass in the "like" variable that corresponds to the input-value by using v-model --> | |
<form v-on:submit.prevent="onSubmit(like)"> | |
<label | |
>What do you like: | |
<input v-model="like" /> | |
</label> | |
<input type="submit" /> | |
</form> | |
</template> |