Skip to content

Instantly share code, notes, and snippets.

View unyo's full-sized avatar

Cody Moniz unyo

View GitHub Profile
@unyo
unyo / initiate_air2.sh
Last active August 16, 2024 09:51
Macbook Air M3 (air2) - Initial install
# Chrome, Slack, VSCode, Synergy, Anyconnect, SizeUp
# RealVNC, Docker, Figma, Firefox, GIMP, Inkscape, NordVPN, VLC, Wireshark
# Android Studio, XCode, nvm
# Epic Games Launcher, Audacity, Disk Inventory X, HandBrake, KeePassX, unetbootin
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install git git-gui curl wget docker-compose
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
# generate SSH keys and add to github, gitlab, idm.tools
@unyo
unyo / vite-create.sh
Last active January 25, 2024 05:57
Vite + SWC + styled-components displayName
#!/usr/bin/zsh
npm create vite@latest # choose template react, js + swc
npm i --save-dev @vitejs/plugin-legacy terser @vitejs/plugin-react-swc @swc/[email protected] # downgrade @swc/plugin-styled-components to 1.5.111 https://github.com/vitejs/vite-plugin-react-swc/issues/190#issuecomment-1907977402
npm i --save styled-components
# edit vite.config.js:
cat <<EOF > vite.config.js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import legacy from '@vitejs/plugin-legacy'
@unyo
unyo / ExampleDialog.java
Last active April 25, 2023 03:01 — forked from codinginflow/ExampleDialog.java
Simple AlertDialog Tutorial
package com.example.myapplication;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDialogFragment;
public class ExampleDialog extends AppCompatDialogFragment {
@unyo
unyo / curl-to-form.js
Last active September 2, 2022 20:52
Curl to Form
// https://jsbin.com/datafudezo/1/edit?js,output
const input = ``; // paste your curl from chrome here
const action = input.match(/curl '([^']+)'/)[1];
const data = input.match(/data-raw '([^']+)'/)[1].split('&');
const inputs = data.map(function(keyval) {
const [key, val] = keyval.split('=');
return '<label for="'+key+'">'+key+'</label><br /><input type="text" id="'+key+'" name="'+key+'" value="'+val+'" /><br />';
});
document.write('<form action="'+action+'">'+inputs.join('\n')+'<input type="submit" /></form>');
@unyo
unyo / .zshrc
Created April 14, 2021 02:27
.zshrc with fnm
# fnm
eval "$(fnm env)"
# add fnm autocomplete
fnm completions --shell=zsh > ~/.config/zsh/completions/_fnm # you can run this once and then comment out
fpath+=~/.config/zsh/completions/_fnm
autoload -U compinit
compinit
# autoload .nvmrc
@unyo
unyo / foodcycler.md
Last active September 11, 2020 21:37
FoodCycler foods

Foods that work well in the FoodCycler from experience. Certain foods do not work well in the FoodCycler (starches, sugars), and it seems like this might be related to the digestion issues cured by a ketogenic diet + intermittent fasting.

GOOD:

  • Coffee Grounds (caffeine cooked into the air may cause you to stay awake)

OKAY:

  • Egg Shells
  • Tomatoes
  • Eggplant
  • Banana Peels

LESS OKAY:

  • Papaya Skins (sugar makes the compost smell sweet, it seems to be the only smell that survives digestion)
@unyo
unyo / build-extras.gradle
Created July 18, 2020 08:12
Fix missing _next folder in Cordova. net::ERR_FILE_NOT_FOUND, file:///android_asset/www/_next/*
// this allows cordova to import folders under _next, which are by default ignored for some reason
// copy this file to platforms/android/build-extras.gradle
// https://stackoverflow.com/questions/9206117/how-to-workaround-autoomitting-fiiles-folders-starting-with-underscore-in/55299304#55299304
// https://issues.apache.org/jira/browse/CB-9448?focusedCommentId=15033508&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-15033508
ext.postBuildExtras = {
android {
aaptOptions {
ignoreAssetsPattern "!._"
}
}
[
{
"metadata": {
"id": "fa57ae0e-d21e-40d8-a0bb-a58b5fd9ead3",
"publisherId": "ms-vscode.atom-keybindings",
"publisherDisplayName": "ms-vscode"
},
"name": "atom-keybindings",
"publisher": "ms-vscode",
"version": "3.0.6"
@unyo
unyo / get-object-keys.js
Last active March 23, 2019 03:07
get all object keys js
const getObjectKeys = (obj, prefix = '') => {
return Object.entries(obj).reduce((collector, [key, val]) => {
const newKeys = [ ...collector, prefix ? `${prefix}.${key}` : key ]
if (Object.prototype.toString.call(val) === '[object Object]') {
const newPrefix = prefix ? `${prefix}.${key}` : key
const otherKeys = getObjectKeys(val, newPrefix)
return [ ...newKeys, ...otherKeys ]
}
return newKeys
}, [])
https://keithclark.co.uk/articles/pure-css-parallax-websites/demo1/
Basically, the idea is:
Top-level page container element (contains navbar body footer, the level which the main scrollbar will be) requires:
#___gatsby {
perspective: 1px;
overflow: auto;
height: 100%;