Skip to content

Instantly share code, notes, and snippets.

View vtenfys's full-sized avatar
🕊️

Valerie Enfys vtenfys

🕊️
View GitHub Profile
@vtenfys
vtenfys / 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.*
@vtenfys
vtenfys / 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;
@vtenfys
vtenfys / 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);
}
@vtenfys
vtenfys / 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 }) {
@vtenfys
vtenfys / 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
@vtenfys
vtenfys / 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"
@vtenfys
vtenfys / 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/,