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
import csv | |
import genanki | |
from gtts import gTTS | |
import unicodedata | |
import re | |
import os | |
import sys | |
from pathlib import Path | |
if len(sys.argv) < 2: |
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
export const getSettlement = (transactions) => { | |
const settlement = [] | |
let recurProtection = 0 | |
while (true) { | |
const balances = getBalances(transactions.concat(settlement)) | |
if (allBalancesZero(balances)) break | |
if (recurProtection++ > 1e2) { | |
console.log({ settlement }) |
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
$source = "C:\Program Files (x86)\World of Warcraft\_classic_era_\Screenshots" | |
$destination = "C:\Users\branv\Proton Drive\bran.van.der.meer\My files\70 - Backups\wow-classic\Screenshots" | |
$zipFolder1 = "C:\Program Files (x86)\World of Warcraft\_classic_era_\Interface" | |
$zipFolder2 = "C:\Program Files (x86)\World of Warcraft\_classic_era_\WTF" | |
$zipLocation = "C:\Users\branv\Proton Drive\bran.van.der.meer\My files\70 - Backups\wow-classic\" | |
$zipDate = Get-Date -Format "yyyy-MM-dd" | |
$zipFileName = "$zipLocation\wowclassic-backup-$zipDate.zip" | |
if (!(Test-Path -Path $destination)) { |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta | |
name="viewport" | |
content="width=device-width, initial-scale=1, viewport-fit=cover" | |
/> | |
<title>video test</title> | |
</head> |
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
import { describe, expect, it } from 'vitest' | |
import { Table, Match } from './six-nations-table' | |
import { | |
matches2table, | |
updateTable, | |
getTable, | |
orderTable, | |
PgamesPlayed, | |
WgamesWon, | |
LgamesLost, |
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 allPeople = ['Aisha', 'Amina', 'Anya', 'Carlos', 'Chen', 'Liam', 'Nia', 'Oliver', 'Raj', 'Yuki' ] | |
const peopleAlreadySpeaking = ['Anya', 'Raj'] | |
const numberOfPeople = 2 | |
// Fisher–Yates shuffle | |
function shuffle(list) { | |
const xs = list.slice() | |
let currentIndex = xs.length | |
let randomIndex |
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
import { useState } from 'react' | |
import { Outlet } from 'react-router-dom' // you don't have to use this necessarily, just an example | |
import Header from 'components/Header' | |
import { makeTranslationValue } from 'hooks/translation' | |
import { TranslationContext } from 'context/translation' | |
import translations from 'data/translations.json' | |
export default function App() { |
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
// Array = ordered + indexed + duplicate values | |
// a.k.a. List | |
const arr = [1, 2, 3] | |
// size | |
arr.length //=> 3 | |
// random-access | |
arr[1] // 2 |
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
// Imperative: 'what' + 'how' | |
const makes1 = [] | |
for (let i = 0; i < cars.length; i += 1) { | |
makes1.push(cars[i].make) | |
} | |
// Declarative: only 'what' | |
const makes2 = cars.map((car) => car.make) |
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
// Producer | |
const range = (min, max, acc = []) => { | |
if (max < min) throw new Error('not supported!') | |
if (min >= max) return acc | |
return range(min + 1, max, acc.concat(min)) | |
} | |
// Consumer | |
const lt100 = range(0, 100) | |
//=> [1, 2, 3, 4, ..., 97, 98, 99] |
NewerOlder