]>
git.wincent.com - hextrapolate.git/log
Greg Hurrell [Sun, 10 Jul 2022 20:44:19 +0000 (22:44 +0200)]
fix: attempt to fix Chrome warning
Error while trying to use the following icon from the Manifest:
https://hex.wincent.com/favicon.ico (Resource size is not correct -
typo in the Manifest?)
Greg Hurrell [Sun, 10 Jul 2022 20:39:11 +0000 (22:39 +0200)]
refactor: put things back the way they were
As mentioned in parent commit.
Greg Hurrell [Sun, 10 Jul 2022 20:35:10 +0000 (22:35 +0200)]
feat: special-case base 16 size calculations
Slight refinement to what I did back in
e4f88cd .
When typing in any input field, `value.base` will reflect the base of
that field. For almost all bases, the behavior implemented in
e4f88cd is
what you want.
But when you're typing in the hex field people are much more accustomed
to thinking in "nibbes" (ie. half-bytes). You don't want to type "1" and
see it be a 1-bit number; you want it to jump straight to 4 bits.
Or maybe not. I'm 50:50 on this and will probably revert it back, while
keeping the component functional.
Bonus: converted to functional component.
Greg Hurrell [Sun, 10 Jul 2022 20:22:28 +0000 (22:22 +0200)]
refactor: eliminate (harmless) copy-pasta
Greg Hurrell [Sun, 10 Jul 2022 20:02:57 +0000 (22:02 +0200)]
chore: regenerate lockfile
Granting us an almost clean bill of health:
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ high │ Inefficient Regular Expression Complexity in nth-check │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ nth-check │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=2.0.1 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ react-scripts │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo > │
│ │ css-select > nth-check │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://www.npmjs.com/advisories/
1070415 │
└───────────────┴──────────────────────────────────────────────────────────────┘
1 vulnerabilities found - Packages audited: 1203
Severity: 1 High
Greg Hurrell [Sun, 10 Jul 2022 20:00:39 +0000 (22:00 +0200)]
chore: update dependencies
Doesn't have much an effect on the `yarn audit` output though:
17 vulnerabilities found - Packages audited: 1206
Severity: 1 Moderate | 4 High | 12 Critical
So next step is going to be to blow away the `yarn.lock` and re-resolve
everything.
Greg Hurrell [Sun, 10 Jul 2022 19:51:56 +0000 (21:51 +0200)]
fix: correct bits/bytes summary
We were taking numbers, converting them to hex, and counting their
length, and multiplying by 8:
f -> 8 bits, 1 byte
ff -> 16 bits, 2 bytes
One fix would be to multiply by 4 instead:
f -> 4 bits, 0.5 bytes
ff -> 8 bits, 1 byte
So this is correct, in a sense, but we don't really want to show
fractional bytes.
Another fix would be, then, to just add a `Math.ceil` so that we'd get:
f -> 4 bits, 1 byte
ff -> 8 bits, 1 byte
But that doesn't feel so good when you're typing binary numbers; eg.
even "1" would show up as "4 bits, 1 byte". By instead converting to
base-2 and continue to use the `Math.ceil` trick, we get the best of
both worlds for these binary values:
1 -> 1 bit, 1 byte
11 -> 2 bits, 1 byte
111 -> 3 bits, 1 byte
1111 -> 4 bits, 1 byte
11111 -> 5 bits, 1 byte
111111 -> 6 bits, 1 byte
1111111 -> 7 bits, 1 byte
11111111 -> 8 bits, 1 byte
Greg Hurrell [Tue, 1 Mar 2022 20:29:32 +0000 (21:29 +0100)]
chore: nuke yarn.lock
Because without this, we die with:
Loading PostCSS "postcss-normalize" plugin failed: Cannot find module 'postcss-normalize'
Greg Hurrell [Tue, 1 Mar 2022 20:22:41 +0000 (21:22 +0100)]
chore: update dependencies
With:
yarn add --dev react-scripts@latest --exact
yarn add classnames@latest prop-types@latest react@latest react-dom@latest --exact
Greg Hurrell [Tue, 1 Mar 2022 20:17:15 +0000 (21:17 +0100)]
refactor: switch from `simple-debounce` to `@wincent/debounce`
Greg Hurrell [Sun, 13 Jun 2021 09:37:31 +0000 (11:37 +0200)]
chore: add target browser configuration
Via:
```
$ react-scripts build
✔ We're unable to detect target browsers.
Would you like to add the defaults to your package.json? … yes
```
Greg Hurrell [Sun, 13 Jun 2021 09:36:13 +0000 (11:36 +0200)]
chore: update deps
Just to quieten `yarn audit` a bit (even `yarn audit --prod` is a
tire-fire at this point).
Greg Hurrell [Sun, 13 Jun 2021 09:23:30 +0000 (11:23 +0200)]
feat: tweak publish.sh to work in this repo
Greg Hurrell [Sun, 13 Jun 2021 09:14:06 +0000 (11:14 +0200)]
chore: prepare to deploy to gh-pages
Get rid of the old deploy.sh script and copy the publish script from my
cv repo. Next commit will contain the necessary edits to get it actually
working.
Greg Hurrell [Tue, 20 Jun 2017 16:48:42 +0000 (09:48 -0700)]
Fix focus bugs on mobile
Changing the value would cause focus to jump to the last field.
Greg Hurrell [Tue, 20 Jun 2017 16:38:27 +0000 (09:38 -0700)]
Don't autocapitalize
Greg Hurrell [Fri, 2 Jun 2017 15:40:00 +0000 (08:40 -0700)]
Some more probably immeasurable microoptimization
Greg Hurrell [Fri, 2 Jun 2017 15:37:20 +0000 (08:37 -0700)]
Microoptimization
Which may or may not be perceptible, and I can't pick it up in the
profiler because it is too noisy.
Greg Hurrell [Fri, 2 Jun 2017 15:32:00 +0000 (08:32 -0700)]
Reuse stack more aggressively
We see that we can always find a re-usable item somewhere in the stack;
we don't have to give up after looking at the last item alone.
Greg Hurrell [Fri, 2 Jun 2017 14:08:29 +0000 (07:08 -0700)]
Get significant speed up via memoization
Greg Hurrell [Fri, 2 Jun 2017 07:00:55 +0000 (00:00 -0700)]
Specify boundary conditions a little more rigorously
Greg Hurrell [Fri, 2 Jun 2017 07:00:34 +0000 (00:00 -0700)]
Add some clarifying comments
Greg Hurrell [Thu, 1 Jun 2017 16:07:03 +0000 (09:07 -0700)]
Ignore leading zeros
Means that converting "0{1000}f" is as fast as converting "f".
Greg Hurrell [Thu, 1 Jun 2017 15:24:12 +0000 (08:24 -0700)]
Revert "Avoid repeated `reverse()` calls in `getDigits` + `joinDigits`"
This reverts commit
54b28015d427b17e78bd7e30a7efbbe3454891c6 .
Greg Hurrell [Thu, 1 Jun 2017 15:24:08 +0000 (08:24 -0700)]
Revert "Replace `unshift()` with `push()` plus `reverse()`"
This reverts commit
f21c36ed85f277522593f1aed902d18f787a34b1 .
Greg Hurrell [Thu, 1 Jun 2017 15:16:38 +0000 (08:16 -0700)]
Replace `unshift()` with `push()` plus `reverse()`
As predicted, this is faster. Not sure if as fast as what I had before.
Will do actual profiling and revert to prior state if it ends up being
better.
Greg Hurrell [Thu, 1 Jun 2017 15:14:08 +0000 (08:14 -0700)]
Avoid repeated `reverse()` calls in `getDigits` + `joinDigits`
Put most significant digits first, which means we avoid the `reverse()`
calls at the cost of having to use `unshift()`. It is indeed slower, but
I wanted to show my work. Next step will be replacing the `unshift()`
with `push()` + `reverse()`, but that probably still won't be enough to
get us back to perf parity.
Greg Hurrell [Thu, 1 Jun 2017 15:03:10 +0000 (08:03 -0700)]
Correct nonsense Flow type
Which reminds me, should actually wire up Flow again.
Greg Hurrell [Thu, 1 Jun 2017 14:57:26 +0000 (07:57 -0700)]
Do hoop jumping to stop React moving cursor to end for invalid input
Greg Hurrell [Thu, 1 Jun 2017 14:10:48 +0000 (07:10 -0700)]
Remove unnecessary calls to ReactDOM.findDOMNode
Greg Hurrell [Thu, 1 Jun 2017 14:05:06 +0000 (07:05 -0700)]
Only replace validators when base changes
Which is rare (only when user selects a new one from one of the dynamic
field drop-downs).
Greg Hurrell [Thu, 1 Jun 2017 14:03:16 +0000 (07:03 -0700)]
Allow 0x prefix on hex numbers
Means that users can type it as a prefix, or paste in a number with this
prefix.
Greg Hurrell [Wed, 31 May 2017 15:11:11 +0000 (08:11 -0700)]
Avoid calling `pop()` on stack
We only ever push as many as 3 items on this stack, so we don't have to
worry about unbounded growth. Let's just maintain an index for the top
of the stack. In a sample run under the Chrome profiler, this shaves off
several hundred milliseconds (hand-waves).
Greg Hurrell [Wed, 31 May 2017 15:08:24 +0000 (08:08 -0700)]
Add a clarifying comment
In case I forget why I have support in here for very large bases.
Greg Hurrell [Wed, 31 May 2017 15:06:45 +0000 (08:06 -0700)]
Correct spelling of spellCheck attribute
Ha.
Greg Hurrell [Wed, 31 May 2017 15:06:21 +0000 (08:06 -0700)]
Avoid repeated indexOf calls
Greg Hurrell [Wed, 31 May 2017 15:05:48 +0000 (08:05 -0700)]
Avoid unwanted spellcheck squiggly lines in input fields
Greg Hurrell [Wed, 31 May 2017 14:27:57 +0000 (07:27 -0700)]
Port tests to structure desired by create-react-app
Greg Hurrell [Wed, 31 May 2017 07:36:45 +0000 (00:36 -0700)]
Remove unused `add` module
Greg Hurrell [Wed, 31 May 2017 07:30:59 +0000 (00:30 -0700)]
Avoid needless work of converting number into its own base
Greg Hurrell [Wed, 31 May 2017 06:59:07 +0000 (23:59 -0700)]
Speed up by avoiding repeated regex construction etc
Avoid repeated regexp allocation, `slice`, `trim` and `toLowerCase`
calls.
Greg Hurrell [Wed, 31 May 2017 06:53:34 +0000 (23:53 -0700)]
Speed up joinDigits by avoiding an extra copy
Greg Hurrell [Wed, 31 May 2017 06:13:57 +0000 (23:13 -0700)]
Don't nest select and input inside label
Massively confuses the iPhone.
Greg Hurrell [Wed, 31 May 2017 06:10:01 +0000 (23:10 -0700)]
Peter Griffin CSS commit
Greg Hurrell [Wed, 31 May 2017 06:05:39 +0000 (23:05 -0700)]
Further attempt at avoiding zoom
Works fine in Chrome device emulation. Not so great on the real phone.
Can't focus the input, and changes to the select menu don't stick.
Greg Hurrell [Wed, 31 May 2017 05:57:39 +0000 (22:57 -0700)]
Disable zoom on select elements too
Greg Hurrell [Wed, 31 May 2017 05:56:11 +0000 (22:56 -0700)]
Increase input field size
In an effort to stop unwanted iOS auto-zooming:
https://stackoverflow.com/questions/
2989263 /disable-auto-zoom-in-input-text-tag-safari-on-iphone
Greg Hurrell [Wed, 31 May 2017 05:51:10 +0000 (22:51 -0700)]
Update fancy deploy script
Greg Hurrell [Wed, 31 May 2017 05:41:08 +0000 (22:41 -0700)]
Add responsive design
Greg Hurrell [Tue, 30 May 2017 14:50:21 +0000 (07:50 -0700)]
Fix wrong link in README
Greg Hurrell [Tue, 30 May 2017 14:25:38 +0000 (07:25 -0700)]
Update page title and favicon
Greg Hurrell [Tue, 30 May 2017 14:21:31 +0000 (07:21 -0700)]
Re-build with create-react-app
Because copying the src files over to a brand new base and tweaking them
is easier than getting a 2-year-old React codebase up-to-date.
Greg Hurrell [Tue, 30 May 2017 13:55:26 +0000 (06:55 -0700)]
gulp-spawn-mocha → gulp-mocha
gulp-mocha now spawns too.
Greg Hurrell [Tue, 30 May 2017 13:53:32 +0000 (06:53 -0700)]
babel → babel-cli
To avoid a deprecation warning.
Greg Hurrell [Tue, 30 May 2017 13:51:52 +0000 (06:51 -0700)]
yarn upgrade-interactive
Upgrade all the things.
Greg Hurrell [Tue, 30 May 2017 13:50:25 +0000 (06:50 -0700)]
Add yarn.lock
Greg Hurrell [Tue, 30 May 2017 13:45:32 +0000 (06:45 -0700)]
Drop explicit strict mode
Implied by use of ES6 modules.
Greg Hurrell [Thu, 6 Aug 2015 06:48:47 +0000 (23:48 -0700)]
Mark package as private to prevent accidental publication
Greg Hurrell [Thu, 6 Aug 2015 06:23:36 +0000 (23:23 -0700)]
Remove .jshintrc
Greg Hurrell [Tue, 4 Aug 2015 17:41:21 +0000 (10:41 -0700)]
Switch from local debounce() to NPM package
Greg Hurrell [Tue, 4 Aug 2015 08:27:22 +0000 (01:27 -0700)]
Make `gulp watch` monitor CSS changes as well
Seeing as CSS is getting bundled via webpack, we should really be
triggering the webpack:build task whenever it changes.
Got rid of the misleading "js" task in the process.
Greg Hurrell [Tue, 4 Aug 2015 08:19:40 +0000 (01:19 -0700)]
Align on baseline, not center
Strictly speaking, this is more correct, although it does look
too high to the naked eye at first glance.
Greg Hurrell [Tue, 4 Aug 2015 08:13:07 +0000 (01:13 -0700)]
Improve vertical alignment within rows
Greg Hurrell [Tue, 4 Aug 2015 08:12:56 +0000 (01:12 -0700)]
Fix monospace styling
This was meant to apply to the input field but was instead
targeting the surrounding span, effectively doing nothing.
Greg Hurrell [Tue, 4 Aug 2015 07:41:15 +0000 (00:41 -0700)]
Reorder some imports for consistency
Greg Hurrell [Tue, 4 Aug 2015 07:41:04 +0000 (00:41 -0700)]
Remove unnecessary lint override
Used to be necessary. No longer so.
Greg Hurrell [Tue, 4 Aug 2015 07:05:35 +0000 (00:05 -0700)]
Update copyright year ranges
Just to show how old this frickin' thing is.
Greg Hurrell [Tue, 4 Aug 2015 06:50:24 +0000 (23:50 -0700)]
Add high-tech deployment script
Greg Hurrell [Tue, 4 Aug 2015 06:29:55 +0000 (23:29 -0700)]
Tweak script path to work locally and via server
This makes file:// URLs work and the webpack dev server at the same
time. I think this will work fine once I've uploaded this to a remote
host.
Greg Hurrell [Tue, 4 Aug 2015 06:20:23 +0000 (23:20 -0700)]
Debounce history updates
Because they're slow.
Greg Hurrell [Tue, 4 Aug 2015 06:18:42 +0000 (23:18 -0700)]
Add simple debounce module
Copy-pasta'd from:
https://github.com/wincent/corpus/blob/
a41b05e0a38f5bdb4c630c206780cae0db91dbea /src/app/debounce.js
Greg Hurrell [Tue, 4 Aug 2015 06:10:44 +0000 (23:10 -0700)]
Fix whitespace lint
Greg Hurrell [Tue, 4 Aug 2015 06:08:07 +0000 (23:08 -0700)]
Update URL with "permalink" to current value
Use Base 62 for compactness. Note that this requires us to upgrade the
internals to handle bigger bases, even though we don't expose base > 36
elsewhere in the UI.
This fulfils the promise in the README that this feature exists.
Greg Hurrell [Tue, 4 Aug 2015 04:24:17 +0000 (21:24 -0700)]
Write README
And update the copyright year ranges, too, to reflect the full
lineage of the project.
Greg Hurrell [Mon, 3 Aug 2015 23:12:53 +0000 (16:12 -0700)]
Drop unnecessary event meddling
Was trying to stop unwanted selection behavior. We still get it, even
with `user-select: none` and this. So, let's just drop it.
Greg Hurrell [Mon, 3 Aug 2015 23:12:18 +0000 (16:12 -0700)]
Sort CSS properties
Greg Hurrell [Mon, 3 Aug 2015 23:11:38 +0000 (16:11 -0700)]
Show cutesy animation when copy to clipboard succeeds
Greg Hurrell [Mon, 3 Aug 2015 22:44:19 +0000 (15:44 -0700)]
Focus first input on load
Greg Hurrell [Mon, 3 Aug 2015 22:41:54 +0000 (15:41 -0700)]
Extract <Size> component
Keeps things a little cleaner.
Greg Hurrell [Mon, 3 Aug 2015 22:34:20 +0000 (15:34 -0700)]
Update broken test
Greg Hurrell [Mon, 3 Aug 2015 22:33:43 +0000 (15:33 -0700)]
Clean up styles
Greg Hurrell [Mon, 3 Aug 2015 17:27:48 +0000 (10:27 -0700)]
Fix charset when "serving" from local filesystem
React converts the entity to a UTF-8 character, which works fine when
serving using the Webpack dev server (which presumably passes an HTTP
Content-Type header), but for testing with a local file:// URL, things
don't work unless we explicitly indicate the type.
Greg Hurrell [Mon, 3 Aug 2015 17:16:23 +0000 (10:16 -0700)]
Generate source map for production build
So that I can meaningfully profile the production build.
Greg Hurrell [Mon, 3 Aug 2015 16:49:18 +0000 (09:49 -0700)]
Put production bundle on a diet
Build was previously at a ridiculous 903,456 bytes.
Restructured config to have entirely separate production settings
without any hotloader stuff in the way, dropping it to 132,015 bytes.
This is still too big, as the app is just a production build of React,
11 small JS modules, and a CSS file, but it's a big improvement.
Greg Hurrell [Sun, 2 Aug 2015 06:19:05 +0000 (23:19 -0700)]
Massive speed-up by avoiding Chrome de-opt in hottest function
I became suspicious of the Math calls thanks to this thread:
https://groups.google.com/forum/#!msg/google-chrome-developer-tools/Y0J2XQ9iiqU/H60qqZNlQa8J
Turns out, those were the culprit.
Greg Hurrell [Sun, 2 Aug 2015 06:05:56 +0000 (23:05 -0700)]
Show byte and bit counts next to title
Greg Hurrell [Sun, 2 Aug 2015 05:52:15 +0000 (22:52 -0700)]
Add a couple of dynamic fields
Greg Hurrell [Sun, 2 Aug 2015 05:34:47 +0000 (22:34 -0700)]
Tweak Field.react
Edits for brevity, and add a title attribute to the copy
link span.
Greg Hurrell [Sun, 2 Aug 2015 05:18:58 +0000 (22:18 -0700)]
Silence a couple of lints
Greg Hurrell [Sun, 2 Aug 2015 03:40:37 +0000 (20:40 -0700)]
Down with require, long live import!
Greg Hurrell [Sun, 2 Aug 2015 03:38:49 +0000 (20:38 -0700)]
Fix copy icon background ordering
I had this working, then sorted the properties, which made it stop
working, because `background` is a shorthand form, and when it came
after the other `background-*` properties in the list it effectively
overrode them.
Make it `background-image` instead, so it doesn't override, and is
immune to sorting vagaries.
Greg Hurrell [Sun, 2 Aug 2015 02:47:38 +0000 (19:47 -0700)]
Add icon for copy button
Got the SVG from: https://icomoon.io/app
Compressed it with svgo (`npm install -g svgo`; see
https://github.com/svg/svgo)
Converted to data URI with: https://gist.github.com/puppybits/
1565441
Did consider skipping the base64-encoding step (ie.
https://css-tricks.com/probably-dont-base64-svg/) but decided against
it. It won't work in old browsers, and isn't much of a space saving
anyway.
Greg Hurrell [Sat, 1 Aug 2015 18:08:33 +0000 (11:08 -0700)]
Add copy-to-clipboard functionality
Should work in recent Chrome, at least.
Greg Hurrell [Sat, 1 Aug 2015 14:06:14 +0000 (07:06 -0700)]
Avoid unnecessary base conversions
Instead of converting to a canonical hexadecimal base format, let the
updating component juts pass back the raw value + base. This should cut
the number of conversions by about 25%. For example, if I change the
binary field, instead of converting to hexadecimal once, then from
hexadecimal to some other base for three of the four fields (ie. four
total conversions), we instead just convert three fields.
Greg Hurrell [Sat, 1 Aug 2015 03:26:19 +0000 (20:26 -0700)]
Add some styling to make layout sane
Greg Hurrell [Sat, 1 Aug 2015 03:00:15 +0000 (20:00 -0700)]
Allow user to fully clear input field
Greg Hurrell [Sat, 1 Aug 2015 02:49:46 +0000 (19:49 -0700)]
Hook up convert() function to UI to show that it works
Greg Hurrell [Sat, 1 Aug 2015 02:46:18 +0000 (19:46 -0700)]
Implement `convert` function
Along with some illustrative tests. More to come (will fill in the blank
`it` blocks).
Based on the technique described at:
http://www.danvk.org/hex2dec.html
Greg Hurrell [Sat, 1 Aug 2015 01:54:37 +0000 (18:54 -0700)]
Don't mutate input array in joinDigits()
`reverse()` is a nasty API. It returns the reversed array, but also
mutates it in place. Noticed while using `joinDigits()` to log stuff
while developing.
Greg Hurrell [Sat, 1 Aug 2015 01:31:22 +0000 (18:31 -0700)]
Extract joinDigits() function