Adam Butler (@labfoo) header
Adam Butler (@labfoo) profile picture

Contract Ruby / JS Developer - Founder @tech_talks_io - @BristolJS organiser - - Creative Coder - Hardware Hacker - Photographer - More @ https://nitter.cf/t.co/dWYhHelw0p

Bristol, UK
Joined May 2007
Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)Photo by Adam Butler (@labfoo)
Day 1 at #RailsWorld! Can’t wait to watch the awesome talks today! And ready for my talk tomorrow about Demystifying some of the magic behind Rails at 11:15am on Track 2!
3
2
1
58
1,943
🚨We just dropped in on Farage’s election rally with a beaming picture of Putin. Nigel was not pleased.
3,688
12,468
3,063
52,224
7,642,851
Adam Butler retweeted
If you’re in #London next Wednesday 1st, I’m speaking at the Ruby in London Meetup about Solid Queue! Come along and find out if my live demo works or not 😅 #rubyfriends #ruby #rails meetup.com/ruby-in-london/ev…
3
7
1
36
2,690
Maths peeps. What’s the best trig/linear algebra for dummies resource out there?
20
6
2
55
19,326
What if the scrollbar went around the corner? 👀 CSS could do that ✨
A scroll indicator that wraps around a rounded corner by @RoberaGeleta
109
529
64
6,237
847,303
CSS Tip! 💪 You can create these tab controls with CSS :has() + radio buttons ✨ .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } .tabs::after { translate: calc(var(--active, 0) * 100%) 0; width: calc(100% / var(--count)); } Two CSS :has() tricks here combined with a rendering trick 🤙 The tab control is a container using display: grid. You can use :has() to count the number of tabs in the container: .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(input:nth-of-type(4)) { --count: 4; } Using the cascade, the last valid :has() gives you the number of tabs 🫶 Once you know the number of tabs, you know how to size the indicator: .tabs::after { content: ""; position: absolute; height: 100%; width: calc(100% / var(--count)); } It's a pseudoelement that uses --count to determine its size 📏 The next :has() trick is determining which tab is active or :checked as it's an input [type=radio] .tabs:has(:checked:nth-of-type(2)) { --active: 1; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } You can use a zero-indexed translation here. If the second input is :checked, set --active: 1, then translate the pseudoelement on the tabs to that position 👉 .tabs::after { translate: calc(var(--active, 0) * 100%) 0; } The last rendering trick is using mix-blend-mode 👀 The tabs have a black background-color, the pseudoelement is white, and the label text is white. When you use mix-blend-mode: difference on the pseudoelement it will give this effect that the text transitions from white to black sliding across 😎 .tabs::after { color: hsl(0 0% 100%); mix-blend-mode: difference; } You can totally mix up the colors here though and go with a different effect. The mechanics of how you can use CSS :has() is the main point here 🙏 As always, any questions, suggestions, etc. let me know @CodePen link below! 👇 (There's even a @tailwindcss play for this one too 👀)
38
200
14
1,950
437,899
🤼‍♂️ Sort ActiveRecord models by an enum value (in SQL!) using `in_order_of` Super handy to float results to the top of a list
4
23
1
183
Today I learned that @stripe charges £0.40 per API call to calculate taxes. That is absurd. Taxes are absurd. Somebody please, for the love of all that is holy, fix this.
34
18
8
439
215,838
Adam Butler retweeted
Love this thread from Jake Rodkin on how the new Steam Deck OLED ad was made using a giant metal orb rig for lighting with Steam Decks! mastodon.social/@ja2ke@idlet…
1
1
276
Adam Butler retweeted
My favorite color generator tool as a designer. ✨💙 You'll love it → randoma11y.com/
21
480
6
3,335
264,355
Launching my ✨new Rails tool✨ — railsg.xyz 🥳 (it's free!) RAILSG is a command builder 🔨 for the Ruby on Rails generator commands. Use the GUI to write your commands and see all their flags and options (rather than the CLI) Check it out! railsg.xyz
15
41
4
196
14,617
In the previous episode we added Search, Sort, and Pagination to a data table. Turbo Frames will help us make it work WITHOUT PAGE REFRESH 🔄❌ 😵‍💫 Along the way we will have to solve some potential problems (page refresh, URL update, redirects). WATCH: superails.com/posts/rails-14…
1
9
62
4,059
This site is so cool railsinspire.com/
1
17
1
151
9,565
Learn more about front-end development and UX/UI design with this video from Pixel Pioneers 2023 CSS, #Javascript and Accessibility – Ire Aderinokun | Pixel Pioneers 2023 youtube.com/watch?v=imn7WGFq… #Js #PixelPioneers
1
2
229
Adam Butler retweeted
What is your style of coding?
406
51
108
1,103
313,336
Murdoch has form. Watch the biopic.
174
3,921
390
7,670
1,226,012
Adam Butler retweeted
Now this is cool and useful as heck. Draw something at shapecatcher.com/ and it'll show you the closest Unicode matches to what you drew.
9
127
5
1,031
152,689