Skip to content

Instantly share code, notes, and snippets.

@BrianPurgert
BrianPurgert / package_managers.md
Created June 9, 2024 04:48
comparison table focusing on the Yehuda Katz-related package managers, with the parallels highlighted
Feature Bundler (Ruby) npm/Yarn (JavaScript) Cargo (Rust)
Purpose Manage gem dependencies for Ruby projects Manage package dependencies for JavaScript projects Manage crate dependencies and build Rust projects
Package Name Gem Package/Module Crate
Manifest File Gemfile package.json Cargo.toml
Lock File Gemfile.lock package-lock.json/yarn.lock Cargo.lock
Default Install Location vendor/bundle node_modules target/ (compiled output), .cargo/registry (downloaded crates)
Core Functionality Resolves and installs gem dependencies based on Gemfile & Gemfile.lock Resolves and installs package dependencies based on package.json & package-lock.json/yarn.lock Resolves and builds crate dependencies based on Cargo.toml & Cargo.lock
**
@BrianPurgert
BrianPurgert / Yehuda_Package_Managers.md
Last active June 9, 2024 04:41
Yehuda Package Managers Comparison of Package Managers Bundler vs. Yarn vs. Cargo

Comparison of Package Managers Bundler vs. Yarn vs. Cargo

Ruby JavaScript Rust
Bundler Yarn Cargo
Manages gem dependencies for Ruby projects Manages packages and dependencies for JavaScript projects Manages packages and dependencies for Rust projects
Gems Packages/Modules Crates
Packages of Ruby programs and libraries Packages of JavaScript programs and libraries Packages of Rust programs and libraries
Gemfile package.json Cargo.toml
Specifies the gem dependencies for a Ruby project Specifies the dependencies and scripts for a JavaScript project Specifies the dependencies and configurations for a Rust project
@BrianPurgert
BrianPurgert / language_crossovers.md
Last active June 9, 2024 02:32
default install locations of dependencies, most popular version managers, and popular packages along with their equivalents.
Ruby JavaScript Rust
Bundler npm Cargo
Manages gem dependencies for Ruby projects Manages packages for JavaScript projects Manages packages and dependencies for Rust projects
Gems Packages/Modules Crates
Packages of Ruby programs and libraries Packages of JavaScript programs and libraries Packages of Rust programs and libraries
Gemfile package.json Cargo.toml
Specifies the gem dependencies for a Ruby project Specifies the dependencies and scripts for a JavaScript project Specifies the dependencies and configurations for a Rust project
Gemfile.lock package-lock.json Cargo.lock
@BrianPurgert
BrianPurgert / chatapp.md
Created January 4, 2024 09:51
testing code blocks in tables
Ruby CodeRBS Type Signature
module ChatApp
	VERSION = "1.0.0"

	class User
@BrianPurgert
BrianPurgert / ruby_rtx.md
Created December 31, 2023 18:47
install Ruby using RTX (asdf Rust clone)

Here's a guide for installing Ruby on Windows Subsystem for Linux (WSL) using rtx, a polyglot runtime manager:

  1. Install RTX: First, install rtx. You can do this by downloading the binary for Linux from the RTX releases page on GitHub. Choose the appropriate version for your system (e.g., rtx-latest-linux-x64 for 64-bit Linux).

    bashCopy code

    curl -L https://github.com/jdx/rtx/releases/download/latest/rtx-latest-linux-x64 > ~/bin/rtx chmod +x ~/bin/rtx

  2. Add RTX to PATH: Make sure that rtx is in your PATH. You can do this by adding the following line to your .bashrc or .zshrc:

@BrianPurgert
BrianPurgert / everything_syntax.md
Created April 3, 2023 06:12
Everything Search Syntax

Operators:

space		AND  
|		OR  
!		NOT  
< >		Grouping  
" "		Search for an exact phrase.  

Wildcard matching:

*		Matches zero or more characters (except \).  
** Matches zero or more characters. 
require 'discordrb'
require 'json'
def ruby_code str
"```ruby\n#{str}\n```"
end
def response(result)
"```ruby\n#{result.to_s}\n```"
.monaco-editor::before {
--grid-color:rgba(115,59,139,0.1);
--grid-size:60px;
--grid-blur:0px;
content: '';
bottom: 0%;
left:0;
position:fixed;
overflow: visible;
margin-left: -50%;
@BrianPurgert
BrianPurgert / unnest_integer_arrays.rb
Last active December 5, 2018 03:11
flatten an array of arbitrarily nested arrays of integers into a flat array of integers
# flattens arbitrarily nested arrays of integers into a flat array of integers.
#
# Examples:
#
# flatten_integer_arrays([[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10])
# # [1,2,3,4,5,6,7,8,9,10]
#
def flatten_integer_arrays(nested)
nested.to_s.scan(/\d+/).map(&:to_i)
end