Skip to content

Instantly share code, notes, and snippets.

@MarZab
MarZab / typeorm.cli.ts
Created July 28, 2022 07:28
TypeORM 0.3 Wrapper
#!/usr/bin/env node
import { spawn } from 'child_process';
import { join } from 'path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
async function runCommand(data: { stage: string }, ...args) {
// eslint-disable-next-line no-console
console.log(
@MarZab
MarZab / api-filter-query.ts
Last active October 23, 2024 21:54
NestJS Filters with Swagger deepObject (example: `?filters[name]=thing1&filters[description]=thing2`)
import { applyDecorators } from '@nestjs/common';
import { ApiExtraModels, ApiQuery, getSchemaPath } from '@nestjs/swagger';
/**
* Combines Swagger Decorators to create a description for `filters[name]=something`
* - has support for swagger
* - automatic transformation with nestjs
*/
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/explicit-module-boundary-types
export function ApiFilterQuery(fieldName: string, filterDto: Function) {
@MarZab
MarZab / .eslintignore
Created July 14, 2020 14:01
Working Serverless Typescript Example
node_modules
.serverless
.vscode
*.config.js
_warmup
**/*.js
// ==UserScript==
// @name Hitri Nakup Notifier
// @version 0.1
// @description Doubleclick on date to start (the button will get a pulsing effect ans start clicking when done)
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @match https://hitrinakup.com/*
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle(`
@MarZab
MarZab / update-dist.js
Created August 21, 2018 10:06
WebExtensions (web-ext) update manifest for self-hosted updates
/**
* Create updates.json for offline automatic updates
* https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Updates
*
* Usage:
* node update-dist.js [path to .xpi files] [path to update.json] [url prefix to .xpi files]
*
* Author:
* marko@zabreznik.net
*/
@MarZab
MarZab / Multiselect.vue
Last active January 15, 2021 19:50
vue-multiselect inside bootstrap-vue; demo: https://codesandbox.io/s/0x608nxo10
<template>
<div
:tabindex="searchable ? -1 : tabindex"
:class="[isOpen?'active':'', disabled?'disabled':'', size && size !== 'default'? 'multiselect-'+size : '' ]"
@focus="activate()"
@keydown.self.down.prevent="pointerForward()"
@keydown.self.up.prevent="pointerBackward()"
@keydown.enter.tab.stop.self="addPointerElement($event)"
@keyup.esc="deactivate()"
class="multiselect">
@MarZab
MarZab / edavki_ekartica_malenkost_boljsi_izvoz.user.js
Last active July 28, 2020 13:25
eDavki eKartica - Malenkost boljši izvoz
// ==UserScript==
// @name eDavki eKartica - Malenkost boljši izvoz
// @version 1.4
// @description Na eKartici portala eDavki doda nov gumb, "Alt. CSV", ki vrne UTF-8 CSV datoteko v standardni obliki datuma. Uporaba na lastno odgovornost.
// @author Marko Zabreznik
// @match https://edavki.durs.si/EdavkiPortal/[*]/PersonalPortal/CommonPages/Documents/eKartica.aspx?RepresentedTaxPayerProfileId=*&form=eKartica
// @grant none
// ==/UserScript==
(function() {
@MarZab
MarZab / __init__.py
Created July 2, 2015 20:46
Ajenti Widget Arbitrary Shell Command Output
from ajenti.api import *
from ajenti.plugins import *
info = PluginInfo(
title='Shiget',
icon='cog',
dependencies=[
PluginDependency('main'),
PluginDependency('dashboard'),
],
@MarZab
MarZab / Vagrantfile
Created June 25, 2015 17:59
Ajenti Demo Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
config.vm.box = "debian/jessie64"
config.vm.hostname = "ajenti-dev"
config.vm.network "private_network", ip: "192.168.150.170"
config.vm.network "forwarded_port", guest: 8000, host: 8000
@MarZab
MarZab / leaflet-custom-map.html
Last active June 15, 2024 00:07
Leaflet with latlng scale in meters and Control.Scale to match
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Custom Simple Map Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-1.0.0-b1/leaflet.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/ardhi/Leaflet.MousePosition/master/src/L.Control.MousePosition.css">