Skip to content

Instantly share code, notes, and snippets.

View valin4tor's full-sized avatar
🛸
LOVE WILL GET YOU THERE

Valerie Enfys valin4tor

🛸
LOVE WILL GET YOU THERE
View GitHub Profile
@valin4tor
valin4tor / JetpackComposeSheets.kt
Last active July 6, 2021 14:13
A recreation of iOS-style sheets using Jetpack Compose
package co.zimly.experimentalpha
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.*
@valin4tor
valin4tor / main.rs
Last active February 7, 2021 19:05
Birthday collision calculator
use num::{
bigint::{BigUint, ToBigUint},
traits::One,
ToPrimitive,
};
fn factorial(num: u32) -> BigUint {
let mut result = BigUint::one();
for i in 1..=num {
result *= i;
@valin4tor
valin4tor / use-promise.js
Last active February 15, 2020 19:24
usePromise React Hook
import { useEffect } from "react";
const promiseMap = new WeakMap();
function usePromise(promise) {
let data = {};
if (promiseMap.has(promise)) {
data = promiseMap.get(promise);
} else {
promiseMap.set(promise, data);
}
@valin4tor
valin4tor / ResponsiveImg.jsx
Created August 22, 2019 18:21
Storyblok Responsive Image
import React from 'react'
import PropTypes from 'prop-types'
function transformImage(image, options) {
const imageService = 'https://img2.storyblok.com/'
const path = image.replace('https://a.storyblok.com', '')
return imageService + options.join('/') + path
}
function getSrcSet({ src, width, height, format, quality, scales }) {
@valin4tor
valin4tor / winrun.sh
Last active June 6, 2022 06:01
Workaround for microsoft/WSL#1614 (place in /usr/bin/winrun)
#!/bin/bash
command=$1
args=${@:2}
winrun_pid=$$
pidfile="/tmp/winrun-pid-$(date +%s)"
if [[ $args != '' ]]; then
argumentlist="-ArgumentList \"$args\""
fi
@valin4tor
valin4tor / chrome.sh
Last active March 13, 2021 10:34
Chrome WSL wrapper script for Cypress (place in /usr/bin/chrome)
#!/bin/bash
if [ "$1" == "--version" ]; then
version=$(reg.exe query 'HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon' /v version | grep version)
echo $version | sed -r -e 's/version\s+REG_SZ\s+/Google Chrome /'
exit
fi
userprofile=$(cmd.exe /C 'echo %userprofile%' | tr -d '\r\n')
cypress_folder="$HOME/.config/Cypress"
@valin4tor
valin4tor / 28.js
Created May 15, 2018 08:19
Algorithm Challenge Week 28 individual task
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const digits = {
'1': /O.*N.*E/,
'2': /T.*W.*O/,