Skip to content

Instantly share code, notes, and snippets.

View dcchambers's full-sized avatar
🚀
happy engineers == productive engineers

Dakota Chambers dcchambers

🚀
happy engineers == productive engineers
View GitHub Profile
@dcchambers
dcchambers / gist:7508ffd0f4e540d38949305303549598
Created February 22, 2024 21:49 — forked from dvliman/gist:10402435
ruby $ global variable
$: (Dollar Colon) is basically a shorthand version of $LOAD_PATH. $: contains an array of paths that your script will search through when using require.
$0 (Dollar Zero) contains the name of the ruby program being run. This is typically the script name.
$* (Dollar Splat) is basically shorthand for ARGV. $* contains the command line arguments that were passed to the script.
$? (Dollar Question Mark) returns the exit status of the last child process to finish.
$$ (Dollar Dollar) returns the process number of the program currently being ran.
$~ (Dollar Tilde) contains the MatchData from the previous successful pattern match.
$1, $2, $3, $4 etc represent the content of the previous successful pattern match.
$& (Dollar Ampersand) contains the matched string from the previous successful pattern match.
$+ (Dollar Plus) contains the last match from the previous successful pattern match.
$` (Dollar Backtick) contains the string before the actual matched string of the previous successful pattern match.
@dcchambers
dcchambers / terminal-snow.md
Last active December 15, 2023 14:50
Terminal Snow (with Ruby)

Terminal Snow

Run the following in your terminal (requires ruby):

ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S=["2743".to_i(16)].pack("U*");a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.1}'
image
@dcchambers
dcchambers / mac-fixes.md
Last active September 4, 2024 17:57
Improve your MacOS Experience

Fixes for Various Mac Issues

A couple of things that may improve your experience using MacOS.

Many of these settings can be configured via the command line (and thus, scripted) using the MacOS defaults tool.

defaults help
defaults read   # list all defaults
defaults write ...
@dcchambers
dcchambers / omglol-tricks.md
Created December 1, 2021 02:33
Tricks, Tips, and Secrets for getting the most out of https://omg.lol

omg.lol Tricks, Tips, and Secrets

Profile Page

  • Create sections in your omg.lol profile by creating [markdown headers] using pound symbols (#) image
  • You can use any [font awesome] icon for items in your profile, even if its not already supported by omg.lol
    • Prepend /font-awesome-icon/ to the text in an item on your profile page.
      • Will default to fas/fa-solid (font awesome solid icons). The fa- part is usually optional.
  • Example: /tree/ treesareawesome.com or /fa-tree/ treesareawesome.com
@dcchambers
dcchambers / tmux-copy-paste.md
Created April 2, 2021 13:37
Copy & Paste in tmux

How to copy & paste in Tmux (with default keybindings)

  • CTRL+B, then [ to enter copy mode and be able to move around the screen with arrow keys.
  • Find the text you want to copy.
  • Press CTRL+SPACE to start copying.
  • Select the text with arrow keys.
  • Press CTRL+W to copy the highlighted text.
    • This automatically exits copy mode.
    • You now have text saved the the Tmux copy buffer.
  • Press CTRL+B, then ] to paste your text.
@dcchambers
dcchambers / git-add-interactive.md
Last active March 15, 2022 19:48
Stage parts of a file for git commit

Using Git Interactive Staging (git add -i)

  • If you have made multiple changes to a file but only want to stage/commit part of that file to git, you can use git's interactive staging tool.
  1. git add -i
  2. Select 5 or p for patch
  3. Select the file(s) with the changes you want to interactively stage.
  4. Git will walk you through different chunks of code in the files you have selected, and you can pick if you want to stage that chunk of code.
@dcchambers
dcchambers / flappy.html
Created November 30, 2020 16:20 — forked from gullyn/flappy.html
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@dcchambers
dcchambers / .gitconfig
Created July 31, 2020 16:15
Git Config to handle multiple email addresses.
[user]
name = Dakota Chambers
email = REDACTED
[core]
ignorecase = false
[url "ssh://[email protected]/"]
insteadOf = https://github.com/