Skip to content

Instantly share code, notes, and snippets.

View johnnypea's full-sized avatar
🏠
Working from home

Ján Bočínec johnnypea

🏠
Working from home
View GitHub Profile
@joperezr
joperezr / Auth.md
Last active April 1, 2025 21:34
Authentication & Authorization in ASP.NET Core

Deep Dive into ASP.NET Core Authentication, Authorization, and Identity

Authentication vs. Authorization vs. Identity

Authentication is the act of verifying who a user is. When a user successfully authenticates (for example, by entering the correct credentials or token), the application establishes the user’s identity (often represented by a ClaimsPrincipal in ASP.NET Core) (Introduction to authorization in ASP.NET Core | Microsoft Learn). In other words, authentication answers “Who are you?” and results in an identity that the app can use. By contrast, Authorization is about what the authenticated user is allowed to do or access. It answers “What are you allowed to do?” ([Introduction to authorization in ASP.NET Core | Microsoft Learn](https://learn.microsoft.com/en-us/aspnet/core/securit

@mdbraber
mdbraber / save-safari-pdf.swift
Last active March 27, 2025 12:54
Save Safari website as PDF (with syncing cookies)
#!/usr/bin/swift
@preconcurrency import WebKit
@preconcurrency import Foundation
@preconcurrency import Darwin
// Disable everything written to stderr
freopen("/dev/null", "w", stderr)
struct Cookie {
@ttscoff
ttscoff / pullremote.sh
Last active February 3, 2025 19:53
remote git pull script
#!/bin/bash
# Remote host is the first argument
HOST=$1
# Remote directory is a mirror of the local directory
DIR=$(pwd)
# SSH to the host and run the pull script
ssh $HOST "~/scripts/remotepull.sh '$DIR'"
# Sync Build notes not stored in git
@mikeslattery
mikeslattery / .idea-lazy.vim
Last active April 22, 2025 00:34
LazyVim mappings for Jetbrains IDEs
" ~/.idea-lazy.vim
" LazyVim mappings for Jetbrains IDEs
" Required plugins. https://plugins.jetbrains.com/bundles/7-ideavim-bundle
" IDEAVim
" Which-Key
" IdeaVim-Sneak
" To install, add this to the top of your ~/.ideavimrc:
@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

@radermacher
radermacher / boost.js
Last active August 28, 2023 10:55 — forked from b-nnett/boost.js
Arc ChatGPT Boost
// fork of https://gist.github.com/b-nnett/2749adb44566239e4c85ad1a8937c2bc
// origin by @B_nnett → https://twitter.com/joshm/status/1648346253355282432?s=20
/*
To set up this boost for chat.openai.com:
1) open Arc browser and login at chat.openai.com.
2) Head over to the + button in your sidebar and select New Boost.
Or hit ⌘ + T and type New Boost into your Command Bar.
3) Click the `Code` button.
@ttscoff
ttscoff / lexers.rb
Last active June 6, 2023 21:54
Find the perfect lexer to highlight your fenced code blocks and other fancy stuff. If you know the common name of a language or a common file extension for it, this script will tell you exactly what most syntax highlighters will recoghize.
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
# Have you ever been adding code to a Markdown post and
# wondered what syntax label would give you the right
# highlighting for your fenced code block? This script can
# take either a file extension or a common name of a language
# and let you know what lexers are supported for it, as well
@barvian
barvian / index.svelte
Last active January 23, 2023 17:36
Vite plugin for SvelteKit
<script context="module" lang="ts">
import type * as $types from './$types'
export const csr = false
export const getData = (async (event) => {
return {
server: event.data.server,
client: 'client data!'
}
@omar2205
omar2205 / +page.svelte
Created January 15, 2023 12:03
Update status action - a toggle/switch action to send a form action
<script lang="ts">
import { updatestatus } from '$lib/UpdateStatus'
import type { PageData } from './$types'
export let data: PageData
</script>
{#each data.users as user}
<input
name="status"
@29decibel
29decibel / build.mjs
Created March 8, 2022 17:51
Use Svelte in Phoenix the simple way
import esbuild from "esbuild";
import esbuildSvelte from "esbuild-svelte";
import sveltePreprocess from "svelte-preprocess";
import { readdir } from "fs/promises";
async function allSvelteComponents() {
const baseDir = "./js/app/";
const all = await readdir(baseDir);
return all.filter((f) => f.endsWith(".svelte")).map((f) => `${baseDir}${f}`);
}