I hereby claim:
- I am ynote on github.
- I am ynote_hk (https://keybase.io/ynote_hk) on keybase.
- I have a public key ASBUyKlcxMZ0n0D1EUCtrQuQwe43DWkoWoovrueauglu4go
To claim this, I am signing this object:
| # SEE CONFIGURATION ON: https://github.com/rails/rails/blob/main/guides/source/configuring.md#configuring-active-storage | |
| # Delete variations when config.active_storage.track_variants = true | |
| my_model_instance.image.service.delete_prefixed(my_model_instance.image.key) | |
| # List all variations on a model | |
| # Here, `my_model_attachment_name` refers to the name I give to the attachment with the `:has_one_attached` macro. | |
| # cf. https://edgeguides.rubyonrails.org/active_storage_overview.html | |
| my_model_attachment_name = "image" | |
| my_model_variations_transformations = MyModel.attachment_reflections[my_model_attachment_name].variants.keys.map do |variant_name| |
| # spec/fixtures/usernames.rb | |
| USERNAMES = ['hermione.granger', | |
| 'ron.weasley', | |
| 'harry.potter', | |
| 'fred.weasley', | |
| 'georges.weasley', | |
| 'luna.lovegood', | |
| 'ginny.weasley', | |
| 'draco.malfoy', | |
| 'albus.dumbledore', |
I hereby claim:
To claim this, I am signing this object:
| class Snail | |
| def initialize(data) | |
| @data = data | |
| @direction = :right | |
| end | |
| def call | |
| values = [] | |
| values << get(x, y) while move | |
| values |
| // ========== Stubs and mocks ========== | |
| // Using sinon-test and sinon-chai | |
| import chai, { expect } from 'chai' | |
| import sinon from 'sinon' | |
| import sinonChai from 'sinon-chai' | |
| global.chai = chai | |
| global.expect = expect |
| import isPlainNumber from 'is-plain-number' | |
| import isStringANumber from 'is-string-a-number' | |
| isPlainNumber('42') // true | |
| isStringANumber('42') // true | |
| isPlainNumber('42e4') // false | |
| isStringANumber('42e4') // false | |
| isPlainNumber(42e4) // true |
| import isPlainNumber from 'is-plain-number' | |
| isPlainNumber('42') // => true | |
| isPlainNumber('42.2') // => true | |
| isPlainNumber('42e4') // => false | |
| isPlainNumber('0x2a') // => false |
| var value = 42e4 // => 420000 | |
| var float = parseFloat(value) // => 420000 | |
| return String(float) === String(value) | |
| // => true | |
| // => String(float) => String(420000) => '420000' | |
| // => String(value) => String(420000) => '420000' |
| var value = '42e4' // => '42e4' | |
| var float = parseFloat(value) // => 420000 | |
| return String(float) === String(value) | |
| // => false | |
| // => String(float) => String(420000) => '420000' | |
| // => String(value) => String('42e4') => '42e4' |
| var value = '4200000000000000000000' // => '4200000000000000000000' | |
| var float = parseFloat(value) // => 4.2e+21 | |
| return String(float) === String(value) | |
| // => false | |
| // => String(float) => String(4.2e+21) => '4.2e+21' | |
| // => String(value) => String('4200000000000000000000') => '4200000000000000000000' |