Skip to content

Instantly share code, notes, and snippets.

View e10a's full-sized avatar
😄

ellen e10a

😄
  • Los Angeles, CA
View GitHub Profile
@e10a
e10a / window
Last active November 23, 2024 15:36
_js
# get root url
window.location.origin
Cross-browser @media (width) and @media (height) values
let vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0)
let vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
window.innerWidth and window.innerHeight
gets CSS viewport @media (width) and @media (height) which include scrollbars
initial-scale and zoom variations may cause mobile values to wrongly scale down to what PPK calls the visual viewport and be smaller than the @media values
@e10a
e10a / brew
Last active November 28, 2024 03:30
_brew
source: https://stackoverflow.com/questions/31968664/upgrade-all-the-casks-installed-via-homebrew-cask
brew upgrade --cask
# However this will not update casks that do not have versioning information (version :latest) or applications that have a built-in upgrade mechanism (auto_updates true). To reinstall these casks (and consequently upgrade them if upgrades are available), run the upgrade command with the --greedy flag like this:
brew upgrade --cask --greedy
# To get outdated:
brew outdated --cask --greedy --verbose
@e10a
e10a / capybara allow clipboard
Created July 10, 2024 14:25
capybara allow clipboard
cdp_params = {
origin: page.server_url,
permission: { name: 'clipboard-read' },
setting: 'granted'
}
page.driver.browser.execute_cdp('Browser.setPermission', **cdp_params)
@e10a
e10a / Rocksbox LoadingSpinner
Created June 3, 2024 16:05
Rocksbox LoadingSpinner
<LoadingSpinner size={25} />
@e10a
e10a / js formatted date
Created May 31, 2024 19:51
js formatted date
new Date().toLocaleDateString('en-us', { weekday:"long", year:"numeric", month:"short", day:"numeric"})
@e10a
e10a / Roxy - delete Communication Preference
Last active July 3, 2024 21:54
Roxy - delete Communication Preference
CommunicationPreference.where(contactable_id: c.id).destroy_all
# loop
cids = Customer.active.last(100).pluck(:id)
cids.select {|id| CommunicationPreference.where(contactable_id: id).destroy_all}
@e10a
e10a / Roxy setting with dates
Last active May 9, 2024 21:31
Roxy - settings with dates
Setting['roxy.show_redeem_gifts_banner_end_date'] = Date.new(1970, 1, 1)
Setting['roxy.show_redeem_gifts_banner_start_date'] = nil
Setting['roxy.show_holiday_banner_end_date'] = Date.new(1970, 1, 1)
Setting['roxy.show_holiday_banner_start_date'] = nil
Setting['roxy.early_clearance_promo_access_start_date'] = nil
Setting['roxy.early_clearance_promo_access_end_date'] = Date.new(1970, 1, 1)
Setting['roxy.early_demi_fine_access_start_date'] = nil
Setting['roxy.early_demi_fine_access_end_date'] = nil
Setting['roxy.holiday_filter_start_date'] = nil
Setting['roxy.holiday_filter_end_date'] = nil
@e10a
e10a / run specific file or folder
Last active September 6, 2024 20:34
_rubocop
# To run a file
rubocop -f files -A app/helpers/application_helper.rb
rubocop -f files -A test/features/roxy/cart_modal_logged_out/edit_billing_info_test.rb
# To run a folder
rubocop -f files -A test/features/roxy/cart_modal_logged_out
# To run on change ruby files only
git ls-files -m | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs rubocop
@e10a
e10a / Gem - install specific version
Created May 6, 2024 19:14
Gem - install specific version
gem install redis -v 4.6.0
@e10a
e10a / Gemfile local
Last active August 1, 2024 18:13
Gemfile local
bundle config install --gemfile=Gemfile.local
# Adds the following to your .bundle/config
BUNDLE_INSTALL: "--gemfile=Gemfile.local"
# install debase
gem install debase -v0.2.5.beta2 -- --with-cflags="-Wno-incompatible-function-pointer-types"