Skip to content

Instantly share code, notes, and snippets.

View DewofyourYouth's full-sized avatar
:octocat:
Pluckin' banjo or crafting a tinfoil hat. Also, sometimes I code. ;)

Jacob E. Shore DewofyourYouth

:octocat:
Pluckin' banjo or crafting a tinfoil hat. Also, sometimes I code. ;)
  • Dew of your Youth
  • Bet Shemesh, Israel
View GitHub Profile
@DewofyourYouth
DewofyourYouth / aliases.zsh
Last active March 27, 2024 12:16
Aliases
alias python="python3"
alias gi="git init ."
alias k8="kubectl"
alias penv="python3 -m venv venv && source venv/bin/activate"
/* eslint-disable no-nested-ternary */
/* eslint-disable no-mixed-operators */
import React from "react";
import Link from "next/link";
import classNames from "classnames";
import useStyles from "@common_slick/Banner/style";
import Thumbor from "@common_image";
import ProductVideo from "@common_slick/Banner/productVideo";
/**
@DewofyourYouth
DewofyourYouth / object-as-props.jsx
Last active November 19, 2023 11:37
Not too many props
/***
* @typedef {Object} User - an user object
* @property {string} firstName - First name of user
* @property {string} lastName - Last name of user
* @property {string} email - the user's email
* @property {string} company - Name of company
* @property {string} department - The department that the user is in
* @property {string[]} permissions - An array of strings representing the user's permissions
*/
@DewofyourYouth
DewofyourYouth / too-many-props.jsx
Created November 19, 2023 11:23
Too Many Props
function UserPanel({
firstName,
lastName,
company,
department,
active,
permissions,
}) {
return (
<>
@DewofyourYouth
DewofyourYouth / choose-your-adventure-bad.jsx
Last active November 15, 2023 15:05
React Bad Adventure
function ChooseAdventure({ adventurer, choice }) {
return (
<div id="adventure">
{choice === "find the holy grail" && (
<div>
Howdy there {adventurer.name}! Are you ready to find the holy grail?
<button onClick={() => goToGrailQuest(adventurer)}>Yes</button>{" "}
<button onClick={changeAdventure}>Change Adventure</button>
</div>
)}
@DewofyourYouth
DewofyourYouth / choose-adventure-better.jsx
Created November 15, 2023 15:00
Better Choose Adventure
const adventureRouter = new Map([
["find the Holy Grail", goToGrailQuest],
["save Princess Peach", goToMarioWorldQuest],
["save Princess Zelda", goToLegendOfZeldaQuest],
]);
function ChooseAdventure({ adventurer, choice }) {
return (
<div id="adventure">
<div>
@DewofyourYouth
DewofyourYouth / streams101.dart
Created February 16, 2022 22:30
An example of a basic StreamController and StreamSubscription
import 'dart:async';
class Person {
final String firstName;
final String lastName;
Person({required this.firstName, required this.lastName});
factory Person.fromMap(Map<String, dynamic> m) {
return Person(
@DewofyourYouth
DewofyourYouth / .sql
Last active October 5, 2021 21:02
make_months_table
-- Gets the start and end dates of all months going back 18 months.
/* DROP TABLE IF EXISTS month_table; # For debugging
CREATE TABLE month_table
(
m_id INT,
month_name VARCHAR(20),
start_date DATETIME,
end_date DATETIME
); */
use std::fs::File;
use std::io::{BufRead, BufReader};
use ansi_term::{Colour, Style};
use rand::Rng;
fn main() {
let phrases_src = "src/phrases.txt";
let phrases_file = File::open(phrases_src).unwrap();
let reader = BufReader::new(phrases_file);
import urllib.request
from bs4 import BeautifulSoup
start = 2801
# only_trs = SoupStrainer('tbody')
end = 2832
for i in range(start, end):
with urllib.request.urlopen(f'https://www.mechon-mamre.org/p/pt/pt{i}.htm') as response:
html = response.read()
soup = BeautifulSoup(html, 'html.parser')