Skip to content

Instantly share code, notes, and snippets.

View JoshDevHub's full-sized avatar

Josh Smith JoshDevHub

View GitHub Profile
@JoshDevHub
JoshDevHub / recursive_contains.js
Last active July 6, 2024 04:26
Recursive Contains
// solution to problem #6 in recursive exercises
function contains(object, searchValue) {
// because `null` has a typof "object", we have to explicitly check
// to prevent trying to access `null`'s values (which don't exist)
if (typeof object !== "object" || object === null) {
return object === searchValue;
}
for (const value of Object.values(object)) {
// An important problem in the code quiz solution is that `return contains()` will only
@JoshDevHub
JoshDevHub / param_manip.md
Created May 11, 2023 15:18
Users manipulating params

Param Manipulation

So let's walk through a quick scenario on your site. I'm signed in as the user "joshodin" and I have one upcoming event (one that I'm hosting). Now there's another user named "usern2" who has a private event set up. I shouldn't be able to see or interact with this event. So far, so good.

image

Now let me click on my event "Event Title". I'm taken to a page where I can take a variety of actions. I can invite people, edit the event, cancel the event, etc. Another thing I can do is declare that I'd like to attend this event. Let's examine this "Attend Event" button in devtools:

image

@JoshDevHub
JoshDevHub / my-lazy-vim.md
Created May 6, 2023 03:05
My LazyVim Setup

Basic LazyVim Setup with Ruby/Rails

A very basic setup for ruby/rails development using LazyVim

Prerequisites

First, you'll of course need neovim. I personally just use the stable release over nightly just because I dislike when things randomly break, and I have to stop working to deal with it. But do whatever you like.

Probably a good idea to start it and run :checkhealth to make sure everything works before proceeding.

@JoshDevHub
JoshDevHub / demonstration.md
Created April 2, 2023 16:23
Don't rely on form information for `current_user`

Don't rely on form information for the current user

So here's the general setup I have. I am currently signed in as second_user. first_user has made a single post with the title "Hello" and the body "This is a post!"

image

Now I'm going to visit "New Post" and make a post. Keep in mind that anything you have in the page markup is observable and editable by the end user. Let me open up devtools on this new page.

image

@JoshDevHub
JoshDevHub / wsl_changes.md
Created April 1, 2023 01:30
List of WSL2 Changes

List of Lessons touched by adding WSL2

  • Installations Overview: The language on the section regarding Windows support and OS options will have to be updated
  • Foundations Installations: Will need to include WSL2 specific installation instructions
  • Text Editors: Will have to show how to use VSCode with WSL2. Introduce WSL-remote extension
  • Command Line Basics: Using the terminal with WSL2. This could just be about using the default Ubuntu terminal that comes with WSL2 Ubuntu, or it could include instructions on using WSL2 via the Windows Terminal.

At some point, it'll need to be communicated how to deal with filesystem difference and in particular, how to move files from Windows to WSL2's filesystem. This could be introduce

@JoshDevHub
JoshDevHub / example.rb
Last active March 8, 2023 16:30
Observable Example with TTT
require "observer"
class Board
include Observable
def initialize
@grid = [" "] * 9
end
def to_s
@JoshDevHub
JoshDevHub / overland_chess_review.md
Last active November 20, 2022 16:44
Overland Chess Review

Overview

So this will mostly be about the things I think can be improved, but I did want to point out that I think there are some cool ideas here, I just don't talk about them much in this review because it'd take way more writing. The Evaluation class is a really neat idea that I think fits with your code very well.

Also obviously a huge accomplishment in general to complete this, and no one's design is perfect (least of all my own). With that said, I'll jump right in

Functionality

Other than the bugs you mentioned, everything seems smooth save this one problem for castling to the queen side, where the participating rook isn't moved. I didn't immediately notice any other bugs going on, which is great!