Skip to content

Instantly share code, notes, and snippets.

@dixpac
dixpac / current_helpers.js
Last active January 25, 2023 12:12
Helpers esbuild alias
// helpers/current_helpers.js
// On-demand JavaScript objects from "current" HTML <meta> elements. Example:
//
// <meta name="current-account-id" content="123">
// <meta name="current-account-subdomain" content="Wizard Lab">
//
// >> current.account
// => { id: "123", subdomain: "Wizard Lab" }
//

Keybase proof

I hereby claim:

  • I am dixpac on github.
  • I am dixpac (https://keybase.io/dixpac) on keybase.
  • I have a public key ASDaB2t7_mzy5uyIxicrC5izmr_AopmxxHv6GfKHd0OmlQo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am dixpac on github.
  • I am dixpac (https://keybase.io/dixpac) on keybase.
  • I have a public key ASAURg5OE2vV93tv-q8AzSGLrKCTShPXzzI7zcaFGHTh_Qo

To claim this, I am signing this object:

@dixpac
dixpac / attr_reader.rb
Last active April 10, 2016 19:42
default implementation via attr_reader
# default implementation via attr_reader
def weight
@weight
end
@dixpac
dixpac / person.rb
Last active April 14, 2016 09:10
Calculate BMI hiding data
class Person
attr_reader :weight, :height
def initialize(weight, height)
weight = weight
height = height
end
def bmi
(weight / (height * height))
@dixpac
dixpac / person.rb
Last active April 10, 2016 19:33
Calculate BMI using instance varaibles
class Person
def initialize(weight, height)
@weight = weight
@height = height
end
def bmi
(@weight / (@height * @height))
end
end
@dixpac
dixpac / gist:0e30cf2cbfc8cf91f774
Created March 19, 2016 09:48
Trix Gemfile.lock
PATH
remote: .
specs:
trix (0.9.5)
rails
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.6)
@dixpac
dixpac / capybara_ext.rb
Created March 5, 2016 13:23
Write page! instead of save_and_open_page in integration tests
# instead of save_and_open_page you can just type
# page!
module CapbaraExt
def page!
save_and_open_page
end
end
RSpec.configure do |config|
config.include CapbaraExt