This file contains 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
# frozen_string_literal: true | |
dot = 'cuchi' | |
dash = 'paulo' | |
# our tree is based on this image | |
# https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Morse-code-tree.svg/1280px-Morse-code-tree.svg.png | |
$morse_tree = { | |
dot => { | |
char: 'e', |
This file contains 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 fs = require('fs'); | |
const filterMap = (list, map) => { | |
const mapped = []; | |
for (let i = 0; i < list.length; i++) { | |
const transformed = map(list[i]); | |
if (transformed) { | |
mapped.push(transformed); | |
} |
This file contains 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 fs = require('fs'); | |
const path = require('path'); | |
const ts = require('typescript'); | |
/** | |
* Parses a barrel (index) file, extracts all it's export | |
* names and returns an object that maps | |
* a import name to the path + some meta infos. | |
* |
This file contains 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
type Foo = { | |
// Assigning undefined here is wrong. | |
// this value either HAVE A KEY WITH VALUE or DON'T HAVE A KEY | |
[key: string]: { foo: string } | |
// const foo: Foo = { key: undefined } | |
// 'key' in foo // true, but should never be the case, because if there's a key, there's a value. | |
} | |
// note: the only case where the index signature might be correctly represented | |
// is when we use a proxy, that way we can guarantee that we always return something |
This file contains 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
function* map(morphism, itr) { | |
let value; | |
while(value = itr.next().value) { | |
yield morphism(value); | |
} | |
} | |
function* filter(predicate, itr) { | |
let value; |
This file contains 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 { createAsyncThunk } from '@reduxjs/toolkit'; | |
import type { AppDispatch, RootState } from './my-store-file'; | |
import { useAppDispatch } from './my-store-file'; | |
import { useCallback } from 'react'; | |
import { useOfflineExecutor } from './offline-executor'; | |
import { createItem } from './create-item-slice.ts'; | |
import { ItemService } from './services'; | |
export type CreateItemThunkArg = { |
This file contains 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
// ⡴⠑⡄⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ | |
// ⠸⡇⠀⠿⡀⠀⠀⠀⣀⡴⢿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀ | |
// ⠀⠀⠀⠀⠑⢄⣠⠾⠁⣀⣄⡈⠙⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀ | |
// ⠀⠀⠀⠀⢀⡀⠁⠀⠀⠈⠙⠛⠂⠈⣿⣿⣿⣿⣿⠿⡿⢿⣆⠀⠀⠀⠀⠀⠀ | |
// ⠀⠀⠀⢀⡾⣁⣀⠀⠴⠂⠙⣗⡀⠀⢻⣿⣿⠭⢤⣴⣦⣤⣹⠀⠀⠀⢀⢴⣶ | |
// ⠀⠀⢀⣾⣿⣿⣿⣷⣮⣽⣾⣿⣥⣴⣿⣿⡿⢂⠔⢚⡿⢿⣿⣦⣴⣾⠁⠸⣼ | |
// ⠀⢀⡞⠁⠙⠻⠿⠟⠉⠀⠛⢹⣿⣿⣿⣿⣿⣌⢤⣼⣿⣾⣿⡟⠉⠀⠀⠀⠀ | |
// ⠀⣾⣷⣶⠇⠀⠀⣤⣄⣀⡀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀ | |
// ⠀⠉⠈⠉⠀⠀⢦⡈⢻⣿⣿⣿⣶⣶⣶⣶⣤⣽⡹⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀ | |
// ⠀⠀⠀⠀⠀⠀⠀⠉⠲⣽⡻⢿⣿⣿⣿⣿⣿⣿⣷⣜⣿⣿⣿⡇⠀⠀⠀⠀⠀ |
This file contains 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 concurrent.futures | |
from time import sleep | |
def expensive_computation(number): | |
sleep(10) | |
return number | |
class Runnable: | |
def __init__(self, original_target, *args, **kwargs): | |
self.original_target = original_target |
This file contains 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
{{>header}} | |
{{>part_of}} | |
class ApiClient { | |
ApiClient({this.basePath = '{{{basePath}}}'}) { | |
{{#hasAuthMethods}} | |
// Setup authentications (key: authentication name, value: authentication). | |
{{#authMethods}} | |
{{#isBasic}} | |
{{#isBasicBasic}} | |
_authentications[r'{{{name}}}'] = HttpBasicAuth(); |
This file contains 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
{ | |
"openapi": "3.0.0", | |
"info": { | |
"title": "Foo", | |
"description": "Foo", | |
"version": "1.0", | |
"contact": {} | |
}, | |
"tags": [], | |
"servers": [], |