Skip to content

Instantly share code, notes, and snippets.


David Gold davidgoldcode

View GitHub Profile
davidgoldcode / .solargraph.yml
Created November 14, 2022 20:57 — forked from searls/.solargraph.yml
My config with steps to use solargraph for Rails projects in VS Code (WIP)
View .solargraph.yml
- ".solargraph_definitions.rb"
- "app/**/*.rb"
- "config/**/*.rb"
- "lib/**/*.rb"
- test/**/*
- vendor/**/*
- ".bundle/**/*"
davidgoldcode /
Created September 28, 2022 16:14 — forked from JoeyBurzynski/
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
View .diff
diff --git a/app/commands/apply_individual_discounts.rb b/app/commands/apply_individual_discounts.rb
index e39a96cd8c..534d134020 100644
--- a/app/commands/apply_individual_discounts.rb
+++ b/app/commands/apply_individual_discounts.rb
@@ -3,7 +3,7 @@ class ApplyIndividualDiscounts
def perform(event_name, order)
return if event_name != "spree.cart.add" || order.blank?
- order.line_items_with_current_flash_sales.each do |line_item|
+ order.line_items_with_current_flash_sales.uniq.each do |line_item|
View .diff
diff --git a/app/services/feature_service.rb b/app/services/feature_service.rb
index 7e25a3392a..128534de99 100644
--- a/app/services/feature_service.rb
+++ b/app/services/feature_service.rb
@@ -4,7 +4,7 @@ class FeatureService
launchdarkly_sdk_key = Rails.application.config.launchdarkly_sdk_key
if launchdarkly_sdk_key.present?
logger.level = ::Logger::WARN
- config = logger)
+ config = logger, connect_timeout: 20.0)
View aliases.zsh
# -------------------------------------------------------------------
# use nocorrect alias to prevent auto correct from "fixing" these
# -------------------------------------------------------------------
alias foobar='nocorrect foobar'
alias g8='nocorrect g8'
# -------------------------------------------------------------------
# Ruby stuff
# -------------------------------------------------------------------
alias ri='ri -Tf ansi' # Search Ruby documentation
davidgoldcode /
Created May 18, 2022 13:28 — forked from sahilsk/
Apache Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
davidgoldcode / tmux split-window
Created May 17, 2022 12:33 — forked from sdondley/tmux split-window
Super Guide to the split-window tmux Subcommand (and Beyond)
View tmux split-window

Super Guide to the split-window tmux Subcommand (and Beyond)

Guide overview

tmux, like other great software, is deceptive. On the one hand, it's fairly easy to get set up and start using right away. On the other hand, it's difficult to take advantage of tmux's adanced power features without spending some quality alone time with the manual. But the problem with manuals is that they aren't geared toward beginners. They are geared toward helping seasoned developers and computer enthusiasts quickly obtain the

davidgoldcode /
Created May 6, 2022 21:18 — forked from bonniss/
Github search cheatsheet from official docs.

Github Search Cheat Sheet

GitHub’s search supports a variety of different operations. Here’s a quick cheat sheet for some of the common searches.

For more information, visit our search help section.

Basic search

View main_changes.diff
diff --git a/.rubocop.yml b/.rubocop.yml
index e6d9b809b1..7320073fe0 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -121,13 +121,80 @@ Style/ConditionalAssignment:
Enabled: false
- Enabled: false
+ Enabled: true

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.


Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}