Skip to content

Instantly share code, notes, and snippets.

View PompaDonpa's full-sized avatar
🦅
Respice finem

Daniel Naranjo PompaDonpa

🦅
Respice finem
View GitHub Profile
@PompaDonpa
PompaDonpa / DivButton.jsx
Created September 3, 2022 00:47
Div as a Button
import React from 'react'
import PropTypes from 'prop-types'
const allowedKeys = ['Enter', 'Space']
const DivButton = ({ hideText, setHideText }) => {
return (
<div
role="button"
tabIndex="0"
@PompaDonpa
PompaDonpa / uiStateLoginScreen.kt
Created September 2, 2022 02:25
Login Page Android State
sealed class UiState {
object SignedOut : UiState()
object InProgress : UiState()
object Error : UiState()
object SignIn : UiState()
}
class MyViewModel : ViewModel() {
private val _uiState = mutableStateOf<UiState>(SignedOut)
val uiState: State<UiState>
@PompaDonpa
PompaDonpa / topicChip.kt
Created August 31, 2022 15:15
Composable TopicChip w/animation
@Composable
fun TopicChip(topic: Topic, selected: Boolean){
val radius by animateDpAsState(
if (selected) 20.dp else 0.dp
)
Card(
shape = RoundedCornerShape(
topStart = radius
)
){
@PompaDonpa
PompaDonpa / bottomNavItem.kt
Last active August 31, 2022 15:23
Composable BottomNavItem - Icon & Text w/animation
@Composable
fun BottomNavItem(
icon: @Composable BoxScope.() -> Unit,
text: @Composable BoxScope.() -> Unit,
animationProgress: () -> Float
// @FloatRange(from = 0.0, to 1.0) animationProgress: Float
) {
Layout(
content = {
Box(
@PompaDonpa
PompaDonpa / rosetta.sh
Last active August 31, 2022 15:16
Rosseta2 for M1
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
arch -x86_64 brew install <package>
@PompaDonpa
PompaDonpa / initialBranch.sh
Last active August 31, 2022 15:17
Version Control | GIT
"To configure the initial branch name to use in all
of your new repositories, which will suppress this warning, call: "
git config --global init.defaultBranch <name>
" Names commonly chosen instead of 'master' are 'main', 'trunk' and
'development'. The just-created branch can be renamed via this command: "
git branch -m <name>
@PompaDonpa
PompaDonpa / bashBasics.sh
Last active August 31, 2022 15:18
Shell Basics
foo=bar
" The value is '$foo'" # prints The value is bar
foo=$(pwd)
" We are in '$foo' " # prints We are in < PATH >
cat <(ls) <(ls ..) # concats the output of ls and ls ..
mkdir sandbox / # Will need permissions
sudo !! # !! inserts mkdir sandbox /
@PompaDonpa
PompaDonpa / shellBasics.sh
Last active August 31, 2022 15:20
Shell Commands
" Moves *.py files to < PATH > "
find . -name "*.py" -print0 | xargs -0 -I {} mv {} /Users/<user>/Desktop/unix_practice/code/python
" Deletes everything inside . but -name <file> "
find . ! -name index.html -delete
" Copies everything with permissions "
cp -rp unix_practice/* ./unix_practice_backup_1
@PompaDonpa
PompaDonpa / gist:c5f3d3e9f51fcdef569cdbeb83cbccf1
Last active December 2, 2022 01:10
Recent Coding in Languages
We couldn’t find that file to show.
@PompaDonpa
PompaDonpa / favIcon.sh
Last active August 31, 2022 15:24
ImageMagick FavIco
convert -background transparent "favicon.png" -define icon:auto-resize=16,24,32,48,64,72,96,128,256 "favicon.ico"
magick -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
convert Operations.gif -coalesce -scale 792x446 -layers Optimize Output.gif
mogrify -format jpg *.heic