Skip to content

Instantly share code, notes, and snippets.

View rrakso's full-sized avatar
🏠
Working from home

Oskar Jaskólski rrakso

🏠
Working from home
View GitHub Profile
@rrakso
rrakso / uuid.class-validator.scalar.ts
Created September 6, 2023 19:22
Custom UUID Scalar for GraphQL on NestJS. Remember to properly set our "custom" type → https://docs.nestjs.com/graphql/resolvers#args-decorator-options
// Modified "vanilla" example. It uses the `isUUID()` function from the `class-validator` package.
import { isUUID } from 'class-validator';
import { GraphQLScalarType, StringValueNode } from 'graphql';
function validate(uuid: unknown): string | never {
if (!isUUID(uuid)) {
throw new Error('The given value is not a UUID string.');
}
return uuid as string;
@rrakso
rrakso / gittag.sh
Created June 17, 2020 13:09 — forked from gregmercer/gittag.sh
Git create new tag
#!/bin/bash
echo -n "Tag Name: "
read -e TAG
git tag $TAG
git push origin --tags
@rrakso
rrakso / allegroImageOpener.js
Created June 15, 2020 10:47
JS snippet to open image from allegro.pl
document.querySelectorAll("img").forEach(e=>{"presentation"===e.getAttribute("role")&&(console.log(e.src),window.open(e.src))});
@rrakso
rrakso / makeJSONfromHTMLlist.js
Last active February 20, 2019 18:58
Skrypcik generujący JSONa z listy pracowników WE ZUT i przekazujący wynik do generatora zaproszeń
function generujJSON(nazwaIDlisty) {
var listaArr = [];
var listaOsoby = ['',''];
var lista = document.getElementById(nazwaIDlisty).children[0].children;
for (var i = 0; i < lista.length; i++) {
var osoba = lista[i].innerText.split(",")[0];
listaOsoby = ['m', osoba];
listaArr.push(listaOsoby);
}
var jsonWykladowcy = JSON.stringify(listaArr);