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
@jurosh
jurosh / relivedown.js
Last active December 2, 2021 03:58
Relive.cc video downloader
// Open BROWSER CONSOLE (F12) and place inside this content
// This will open source file...
// You need to save it manually with `ctrl + s`
(function openVideoFile() {
const downa = document.createElement('a');
downa.id = 'videofileClickme'
downa.href = document.querySelector("meta[property=\"og:video:secure_url\"]").content
downa.download = 'MyRide';
document.body.appendChild(downa)
videofileClickme.click();
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 / RPi_I2C_driver.py
Created March 4, 2017 11:21 — forked from DenisFromHR/RPi_I2C_driver.py
RaspberryPi I2C LCD Python stuff
# -*- coding: utf-8 -*-
"""
Compiled, mashed and generally mutilated 2014-2015 by Denis Pleic
Made available under GNU GENERAL PUBLIC LICENSE
# Modified Python I2C library for Raspberry Pi
# as found on http://www.recantha.co.uk/blog/?p=4849
# Joined existing 'i2c_lib.py' and 'lcddriver.py' into a single library
# added bits and pieces from various sources
# By DenisFromHR (Denis Pleic)