Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
helping out on OSS and writing 👍

Andria Brown andria-dev

:octocat:
helping out on OSS and writing 👍
View GitHub Profile
@andria-dev
andria-dev / bad_chars.py
Last active Jul 3, 2021
Python Buffer Overflow Bad Characters
View bad_chars.py
#!/usr/bin/env python3
"""
# Usage
Copy and paste the below line of code into your Python interpreter and
it will give you a string of all characters from 1 to 255 inclusive that
you can copy and paste into your Python code to generate your payload.
You can also just copy the result that I already have here lol.
"""
View Accessibility Differences in Burger Menu Structures.md

Accessibility of Burger Menu Structures

When creating a navigation menu that can be expanded/opened and closed, it is important that the navigation landmark itself, the <nav>, remain visible at all times for those using a screen reader that are looking for that landmark. Alongside this, the button that is used to expand the navigation menu needs to be inside of the navigation landmark for the most accessible experience. When the button is inside the <nav>, the screen reader user can easily find that button when jumping to the navigation landmark.

@andria-dev
andria-dev / wsl.sh
Last active Sep 7, 2021
WSL Config
View wsl.sh
#!/bin/bash
# function definitions
pressAnyKeyToContinue() {
read -n 1 -s -r -p "Press any key to continue."
}
# Get sudo privileges beforehand
sudo -v
@andria-dev
andria-dev / front-end.jsx
Created Feb 16, 2021
Example usage of use-shopping-cart for README
View front-end.jsx
// Front-End: Let's pick our product, ask for a Session ID, and redirect to the checkout page.
import { useShoppingCart, formatCurrencyString } 'use-shopping-cart'
function Product({ product }) {
const { redirectToCheckout } = useShoppingCart()
const { name, image, description, currency } = product
const price = formatCurrencyString({ value: product.price, currency, language: 'en-US' })
async function buyNow() {
const response = await fetch("/.netlify/functions/create-session", {
@andria-dev
andria-dev / Get-NodePackages.ps1
Created Nov 5, 2020
A Powershell function to get all of the node dependencies defined in a JSON file that match a pattern.
View Get-NodePackages.ps1
# Usage: yarn remove $(Get-NodePackages -Pattern 'gatsby')
function Get-NodePackages {
param (
$Pattern = '.*',
$PackagePath = '.\package.json'
)
$package = ConvertFrom-Json $(gc $PackagePath | Out-String)
$dependencies = $package.dependencies ?? @()
$devDependencies = $package.devDependencies ?? @()
@andria-dev
andria-dev / half-precision-floats.js
Last active Apr 16, 2020
A function for converting a floating point number into binary (half precision)
View half-precision-floats.js
// Half Precision Floats
/**
* @description Converts a binary number like: 1100101011000000
* sign | exponent | significand
* 1 | 10010 | 1011000000
*
* back into it's decimal representation, in this case it's -13.5
*
* @param {string} binaryString a binary number in string format
@andria-dev
andria-dev / preact-prop-checker.js
Last active Nov 30, 2018
A simple preact prop checker that uses custom functions to verify props.
View preact-prop-checker.js
import preact from 'preact';
function printWarning(message) {
message = `Warning: ${message}`;
if (typeof console !== 'undefined') {
console.error(message);
}
}
// installs global prop checker