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
{ | |
components: { | |
schemas: { | |
HALLink: { | |
type: 'object', | |
properties: { | |
api: { type: 'string', example: 'https://egeniq.com/page' }, | |
web: { type: 'string', example: 'https://egeniq.com/page' } | |
}, | |
required: [ 'api', 'web' ] |
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 {z} from "zod"; | |
import {extendZodWithOpenApi, OpenAPIGenerator, OpenAPIRegistry} from "@asteasolutions/zod-to-openapi"; | |
// We can now use `.openapi()` to specify OpenAPI metadata, eg z.string().openapi({ description: 'Some string' }); | |
extendZodWithOpenApi(z); | |
const registry = new OpenAPIRegistry(); | |
const HALLink = z.object({ | |
api: z.string().openapi({ example: 'https://egeniq.com/page' }), | |
web: z.string().openapi({ example: 'https://egeniq.com/page' }), |
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
<!DOCTYPE html> | |
<html lang="fi"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |
</head> | |
<body> | |
</body> | |
<script> | |
var params; |
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
""" | |
Usage like: | |
class SomeResolver(PaginationMixin, ModelResolver): | |
model = SomeModel | |
and | |
class SomeOtherResolver(PaginationMixin, ModelResolver): | |
model = SomeOtherModel |
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
#!/bin/bash | |
SECRET=YOURSECRET | |
WRITE_TO_DIR=src/messages | |
URL="https://translationhut.com/export/flat_json?languages=EN-US,NL-NL&include_empty=false" | |
# Download file to messages.zip | |
curl "$URL" -H "Authorization: Api-Key $SECRET" --output messages.zip | |
# unzip messages.zip to relative path folder, declared in "WRITE_TO_DIR" |
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 can add all missing vue-i18n translations in | |
your Vue App to your TranslationHut.com project | |
Setup vue-i18n: https://kazupon.github.io/vue-i18n/started.html | |
Setup TranslationHut.com | |
1. Signup and create a project at TranslationHut.com | |
2. Go to "develop" | |
3. Create an API-key -> Paste the secret in this file |
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
def permission_middleware(next, root, info, **args): | |
""" | |
Passes trough every field. | |
next: Call next to continue evaluation. | |
root: model instance which the field belongs to | |
args: dict of arguemnts passed to the field | |
Info params: | |
- field_name | |
- field_asts (info about field) | |
- return_type (of field) |
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
// Get item from list based on any String | |
// Example: | |
// var arr = [0, 1, 2, 3, 4, 5, 6]; | |
// pickValueByString(arr, "Text"); // >> 1 | |
// pickValueByString(arr, "text"); // >> 5 | |
// pickValueByString(arr, "other text"); // >> 2 | |
// pickValueByString(arr, "Text"); // >> 1 | |
function byteValue(str) { | |
var totalBytes = 0; |