Skip to content

Instantly share code, notes, and snippets.

View firedev's full-sized avatar
👁️
👁

Nick Ostrovsky firedev

👁️
👁
View GitHub Profile
@firedev
firedev / reload.js
Last active March 4, 2024 21:07
Turbo Stream Actions
// <turbo-stream action="reload" target="frame-id"></turbo-stream>
StreamActions.reload = function () {
document.getElementById(this.getAttribute("target"))?.reload()
}
@firedev
firedev / Hotwire Turbo Debugger.md
Last active January 24, 2024 17:16
Hotwire/Turbo CSS Debugger
  • Install Stylebot or another CSS extension
  • Paste CSS
  • Enjoy highlighted turbo-frames, forms, and changed elements on the page
image
@firedev
firedev / stimulus_to_alpine.md
Created March 24, 2023 09:54
Stimulus to Apline.js for Hotwire

When replacing Stimulus with Alpine there are some things we need to consider. I propose to follow rails conventions as close as possible.

  1. Naming of files. Snake case, same file name. In Stimulus everything ends in _controller btw.
legos/
  select.rb
  select.html.slim
  select.js
@firedev
firedev / mermaid.md
Last active February 16, 2023 06:57
graph
TrackingTime --> ManualTime
TrackingTime --> AutomaticTime
TrackingTime --> MobileTime
graph
T(TrackingTime)
### Keybase proof
I hereby claim:
* I am firedev on github.
* I am firedev (https://keybase.io/firedev) on keybase.
* I have a public key ASAx0EdMDYGlPGXQUvWIvi76fKLc6n5oeYeFyPAhfqlB3Ao
To claim this, I am signing this object:
@firedev
firedev / .md
Last active April 22, 2020 04:33
PICO-8 Class-like Objects in pico-8 https://www.lexaloffle.com/bbs/?tid=2951

With the introduction of the function type() it is now possible to know the type of the variable.

So I tried to find a way to implement a simple class system and I think I found a way

First we need a function to copy tables

function copy(o)
  local c
@firedev
firedev / .p8
Created April 22, 2020 04:23
PICO8 Tweetcart
-- https://twitter.com/lucatron_/status/1252171663883423745
-- https://gist.github.com/lucatronica/5d1b2bdceced5d5f1315b8e2f252146e
for i=1,8 do pal(i,({8,11,10,140,14,12,7})[i],1)end
::_::cls()
?"#pico8♥",0,0,8
for i=0,2 do
k=.25+i/60+cos(t()/8)/5
for y=0,5,.25 do
for x=0,30,.25 do
@firedev
firedev / asyncWrap.js
Created April 21, 2020 12:43
AsyncWrap — so there is no catch
const asyncWrap = (promise) => (
promise.then(res => [res]).catch(err => [undefined, err])
)
const func = async () => {
const [result, error] = await asynced( doStuff()) )
}
@firedev
firedev / collision.p8
Last active April 20, 2020 06:44
pico8 utils
--[[ collision detection ]]--
-- point inside the rectangle
function is_point_in_rect(x,y,left,top,right,bottom)
return top<y and y<bottom and left<x and x<right
end
function lines_overlapping(min1, max1, min2, max2)
return min1>min2 and max2>min1
end