Skip to content

Instantly share code, notes, and snippets.

View sergii's full-sized avatar

Serhii Ponomarov sergii

View GitHub Profile
@bradgessler
bradgessler / phlex_element.rb
Last active January 3, 2024 22:21
The Phlex::Element class makes creating simple Phlex components easier
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "phlex"
end
require "phlex/testing/view_helper"
include Phlex::Testing::ViewHelper
@tabishiqbal
tabishiqbal / _form.html.erb
Last active May 2, 2024 13:30
Ruby on Rails Tom-Select Example with Stimulus controller
<%= form_with(model: team) do |form| %>
<div>
<%= form.label :name %>
<%= form.text_field :name, class: "input" %>
</div>
<div>
<%= f.select :user_id, {}, {placeholder: "Select user"}, {class: "w-full", data: { controller: "select", select_url_value: users_path }} %>
</div>
@robbyrussell
robbyrussell / argonista-disk-space-reclaimer.sh
Created August 28, 2021 20:53
Planet Argon - Tidy up your Rails development/test.log files and brew cleanup
#!/bin/sh
# A little shell script to help you reclaim disk space by doing the
# following things on your Mac OS development machine.
# * Empty all of your local development.log files
# * Empty all of your local test.log files
# * Removes unused Homebrew packages
# Install:
# * Save this to ~/bin/argonista-disk-space-reclaimer.sh
# * Run % chmod +x ~/bin/argonista-disk-space-reclaimer.sh
# Usage:
@andrewmcodes
andrewmcodes / 10x.erb
Last active August 4, 2021 17:05
html is so 2008
<%= render ArticleComponent.new do %>
<%= render StackComponent.new do %>
<%= render BoxComponent.new(as: :header) do %>
<%= render HeaderComponent.new.with_content(resource.data.title) %>
<%= render TextComponent.new(tone: :secondary) do %>
<%= render LinkComponent.new(href: "/").with_content("Andrew Mason") %>
• <%= pretty_date resource.data.updated_at %>
• <%= reading_time resource.content %> Minute Read
<% end %>
<% end %>
import { Controller } from "stimulus";
import { get } from "@rails/request.js";
import { PageSnapshot } from "@hotwired/turbo";
export default class extends Controller {
static values = { hoverTime: Number };
connect() {
this.element.addEventListener("mouseover", this.prefetch.bind(this));
this.element.addEventListener("touchstart", this.prefetch.bind(this));
}
<!-- app/views/boards/_board.html.erb -->
<ul class="..."
data-controller="board"
data-board-signed-resource-value="<%= board.to_sgid.to_s %>"
id="<%= dom_id(board) %>">
<!-- ... -->
</ul>
@maxim
maxim / Excellent Karaoke Setup Guide.md
Last active December 24, 2022 03:12
An excellent high quality karaoke setup for under $1000

Excellent high quality karaoke setup for under $1000

For my Vietnamese wife a good karaoke setup is serious business. Problem is, I noticed that some people spend thousands of dollars on unnecessary stuff like gigantic receivers and speakers, only to end up with hiss, clipping, and clunky operation. Smart/consistent home setup should definitely fit under $1000, and that's with speakers and expensive Nvidia Shield box. You could definitely cut it to under $500 and still have a great setup. I did some research and put together a convenient setup for amazing quality at-home karaoke that isn't worth thousands, isn't a chore to operate, and passes Asian quality standards with flying colors.

How to use this setup once it's ready:

  1. You find any song on your phone's Youtube and cast it to your TV
  2. You pick up the microphone, start singing, and it all just sounds surprisingly beautiful

This guide assumes that you already have a TV with HDMI ARC or Optical/Coaxial audio output, and that you have WiFi at home.

import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["source"];
copy() {
const range = document.createRange();
window.getSelection().removeAllRanges();
import { Controller } from 'stimulus'
export default class extends Controller {
static targets = ['overlay']
static values = {
hidden: Boolean
}
static classes = ['hidden', 'shown']
toggle () {