This component can be used on any page where you want to check if a user is logged in.
If not logged in, they will be redirected to the login page.
The useEffect
hook waits until things are ready before checking the session status
function commit() { | |
local commit_message | |
if [[ $# -eq 0 ]]; then | |
echo "Usage: commit <message>" | |
return 1 | |
fi | |
commit_message="${*:1}" |
cycles=$(system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $NF}') | |
maxcap=$(system_profiler SPPowerDataType | grep "Maximum Capacity" | awk '{print $NF}') | |
condition=$(system_profiler SPPowerDataType | grep "Condition" | awk '{print $NF}') | |
echo '{ | |
"items": [ | |
{ | |
"uid": "battery-cycles", | |
"arg": "'"$cycles"'", | |
"title": "Battery Cycles: '"$cycles"'", | |
"subtitle": "Copy Battery Cycles to Clipboard", |
#!/bin/zsh | |
# Step 1: Get the current branch name | |
current_branch=$(git symbolic-ref --short HEAD) | |
# Step 2: Determine the target branch | |
target_branch="main" # Default to "main" branch | |
if ! git show-ref --verify --quiet "refs/heads/$target_branch"; then | |
target_branch="master" # Use "master" branch if "main" doesn't exist | |
fi |
# git shortcuts | |
alias g=git | |
alias gst='git status' | |
alias ggpush='git push origin $(git rev-parse --abbrev-ref HEAD)' | |
alias ggpull='git pull origin $(git rev-parse --abbrev-ref HEAD)' | |
alias pull='ggpull' | |
alias pul='ggpull' | |
alias ggpnp='ggpull && ggpush' | |
alias gco="git checkout" | |
alias gc-='git checkout -' |
function branch() { | |
local branch_name | |
if [[ $# -eq 0 ]]; then | |
echo "Usage: branch <name>" | |
return 1 | |
fi | |
if [[ $1 =~ [^a-zA-Z0-9._-] ]]; then | |
echo "Invalid branch name: $1" | |
return 1 | |
fi |
// create an express app (import express first) | |
const app = express(); | |
// tell app to use bodyParser, I believe this still needs to be imported but it's installed with express last I checked | |
// bodyParser will help keep your incoming http POST body clean | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({extended: false})); | |
// set the view engine to be pug ONLY if you want a view engine | |
// if you're displaying static content in vue.js or React, you can just let it be HTML |
/* this version wasn't working | |
$(document).on('keydown', function(e) { | |
if (e.key == "ArrowRight" || e.key == " ") { | |
let next = $('a').filter((b, anchor) => $(anchor).text().includes('next') ) | |
next.click(); | |
} | |
}); | |
*/ | |
// working version |
Verifying my Blockstack ID is secured with the address 13LDAQ1kgtKivD4DxUVeWQrAV3kogTrtLB https://explorer.blockstack.org/address/13LDAQ1kgtKivD4DxUVeWQrAV3kogTrtLB |
version: "3" | |
services: | |
web: | |
image: usmanity/friendlyhello:part2 | |
deploy: | |
replicas: 2 | |
resources: | |
limits: | |
cpus: "0.1" | |
memory: 50M |