Skip to content

Instantly share code, notes, and snippets.

View benedyktdryl's full-sized avatar

Benedykt Dryl benedyktdryl

View GitHub Profile
@benedyktdryl
benedyktdryl / Structure.md
Created September 6, 2022 09:22 — forked from hstemplewski/Structure.md
Front-end structure proposal
@benedyktdryl
benedyktdryl / filters.js
Created March 7, 2022 22:46 — forked from deckchairlabs/filters.js
Prisma Custom Generator
#!/usr/bin/env node
const path = require('path')
const generatorHelper = require('@prisma/generator-helper')
const { Project, StructureKind, VariableDeclarationKind } = require('ts-morph')
generatorHelper.generatorHandler({
onManifest(config) {
return {
prettyName: 'Filters',
defaultOutput: path.resolve(__dirname, 'filters'),
// `Omit` omit specific keys from existing interface
type Diff<T extends string, U extends string> = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T];
type Omit<T, K extends keyof T> = {[P in Diff<keyof T, K>]: T[P]};
// `Omit` usage
type TCleanedUser = Omit<IUser, 'privateField1' | 'privateField2'>;
@benedyktdryl
benedyktdryl / typescript-react-quickstart.md
Last active June 10, 2017 15:15
Quick notes for people starting with React & Typescript
'use strict'
const fs = require('fs')
const Hapi = require('hapi')
const Http2 = require('http2')
const server = new Hapi.Server()
let listener = Http2.createServer({
key: fs.readFileSync('./key.pem'),
cert: fs.readFileSync('./cert.pem')
})
@benedyktdryl
benedyktdryl / es6-simple-compose.js
Created February 15, 2017 13:22
Simple composition helper for FP in ES6.
const compose = (...callbacks) => (
(...args) => (
callbacks.reduce((prev, callback) => (
[callback(...prev)]
), args)
)
);
compose(
(x) => (x * 2),
@benedyktdryl
benedyktdryl / cloudSettings
Last active July 15, 2020 12:52
Visual Studio Code Sync Settings GIST
{"lastUpload":"2020-07-15T12:52:30.621Z","extensionVersion":"v3.4.3"}
# Just point the sleepimage to your .Trash folder and empty your trash bin after wake up.
# http://apple.stackexchange.com/a/191563
sudo pmset -a hibernatefile ~/.Trash/sleepimage
# Set this to 1 to enable startup
ENABLED=1
# The user to run Kodi as
USER=root
# Adjust niceness of Kodi (decrease for higher priority)
NICE=-5
@benedyktdryl
benedyktdryl / interview-question-2.js
Last active December 12, 2016 12:18
Why is “this” in an anonymous function undefined when using strict? http://stackoverflow.com/a/9822631/689748
(function(){
"use strict";
(function() {
console.log(this);
})();
function test() {
console.log(this);
}