Skip to content

Instantly share code, notes, and snippets.

View DimosthenisK's full-sized avatar

Dimosthenis Kalaitzis DimosthenisK

View GitHub Profile
@DimosthenisK
DimosthenisK / index.js
Created January 26, 2020 16:48
Legends Of Runeterra Auto-Surrender script for daily XP
const robot = require("robotjs");
function wait(ms, variability) {
return new Promise(resolve => {
setTimeout(resolve, ms + Math.random() * variability);
});
}
let conf = {
waitBetweenSteps: {
@DimosthenisK
DimosthenisK / self.decorator.ts
Created December 17, 2019 10:14
NestJS Guard + Decorator that allows user access limit to his own resources
import { SetMetadata } from '@nestjs/common';
export interface SelfDecoratorParams {
userIDParam: string;
allowAdmins?: boolean;
}
export const Self = (params: SelfDecoratorParams | string) =>
SetMetadata(
'selfParams',
@DimosthenisK
DimosthenisK / cloudSettings
Created May 27, 2019 21:49
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-05-27T21:48:59.808Z","extensionVersion":"v3.2.9"}
@DimosthenisK
DimosthenisK / axiosRetry.js
Last active October 25, 2019 11:56
Axios Request Retry function - ES7 implementation of axios request retry
/**
Asynchronous Recursive Request retry with Axios
Author: Dimosthenis Kalaitzis <dimostheniskalaitzis@gmail.com>
Requires Axios
Throws error after failing all available attempts
@param requestParams AxiosRequestOptions
@param attempts number
*/
async sendRequest(requestParams, attempts = 0) {
@DimosthenisK
DimosthenisK / package.json
Created March 2, 2019 16:42
Jest Sample configuration
"jest": {
"transform": {
".(ts|tsx)": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json"
@DimosthenisK
DimosthenisK / nodemon.json
Created March 2, 2019 16:29
Example nodemon configuration file
{
"ignore": ["**/*.test.ts", "**/*.spec.ts", ".git", "node_modules"],
"watch": ["src"],
"exec": "npm start",
"ext": "ts"
}
@DimosthenisK
DimosthenisK / tsconfig.json
Created March 2, 2019 16:23
Sample TSConfig
{
"compilerOptions": {
"module": "commonjs",
"target": "es2018",
"outDir": "dist",
"inlineSourceMap": true,
"inlineSources": true,
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,