Skip to content

Instantly share code, notes, and snippets.

View jurosh's full-sized avatar

Jurosh jurosh

View GitHub Profile
@jurosh
jurosh / gist:eb0b10cdfa45c61ba99f6a441b316c21
Last active November 20, 2023 19:39
Prettier ternaries format
// Prettier < 3
const reactRouterResult =
children && !isEmptyChildren(children)
? children
: props.match
? component
? React.createElement(component, props)
: render
? render(props)
: null
@jurosh
jurosh / base.blade.php
Last active September 11, 2023 20:44
base.blade.php
<?php echo '<?xml version="1.0" encoding="UTF-8" ?>'; ?>
<?php echo '<?xml-stylesheet type="text/xsl" href="'.url('sitemap.xsl').'" ?>' ?>
<!-- generated-on="{{ date('m/d/Y h:i:s a', time()) }}" -->
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>{{ url('/') }}</loc>
<changefreq>daily</changefreq>
<priority>0.8</priority>
const vowels = 'aeiou';
function sol1(str) {
return str
.split('')
.filter((letter) => !vowels.includes(letter.toLowerCase()))
.join('');
}
function sol2(str) {
@jurosh
jurosh / plugin-engines.jsplugin-engines.js
Created December 15, 2022 19:25
YARN engines check
/* eslint-disable */
// Copied from https://github.com/devoto13/yarn-plugin-engines
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-engines",
factory: function (require) {
var plugin=(()=>{var P=Object.create,f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var b=n=>f(n,"__esModule",{value:!0});var i=n=>{if(typeof require!="undefined")return require(n);throw new Error('Dynamic require of "'+n+'" is not supported')};var T=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},V=(n,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of N(e))!Y.call(n,t)&&t!=="default"&&f(n,t,{get:()=>e[t],enumerable:!(r=R(e,t))||r.enumerable});return n},s=n=>V(b(f(n!=null?P(j(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var U={};T(U,{default:()=>q});var o=s(i("@yarnpkg/core")),c;(function(r){r.Yarn="Yarn",r.Console="Console"})(c||(c
type ReducerActions<R extends Reducer<any, any>> = R extends Reducer<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
any,
infer U
>
? U
: never;
// V1 formatted nicely on more lines...
// V2
return side === 'buy' ? 'Buy' : side === 'sell' ? 'Sell' : 'Unknown';
const interpolation = (text, ...args) => {
text;
args;
return args.reduce((acc, fn, index) => {
return acc + text[index + 1] + (typeof fn === "function" ? fn() : fn);
}, text[0]);
}
const test = interpolation`huraaay
Teraz ide ${() => 'prvy'} potom ${'druhy'} a strieborny ${'treti'}!
{
"compilerOptions": {
"module": "commonjs",
"allowJs": true,
"baseUrl": "./src"
},
"include": ["./src"]
}
@jurosh
jurosh / readme.md
Last active July 18, 2018 12:30
Security Vulnerabilities - Regex

Catastrophic Backtracking (JavaScript Regex)

Source https://www.youtube.com/watch

/A(B|C+)*DE?/.test('ACCCCCCCCCCCCCCCCCCCCCCCCCCCCC')

/A(B|C+)*DE?/.test('ACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC')

/A(B|C+)*DE?/.test('ACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC') // Do not run me!
@jurosh
jurosh / tutorial.md
Created June 21, 2018 10:16 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.