Skip to content

Instantly share code, notes, and snippets.

@byteg
byteg / message-item.hbs
Created August 28, 2023 11:28
messages
{{#if this.isMyMessage }}
<Dialogs::MyMessageItem @message={{@message}} />
{{else}}
<Dialogs::OtherMessageItem @message={{@message}} />
{{/if}}
@byteg
byteg / coupon.rb
Last active March 10, 2022 19:51
Ruby code example
class Coupon < ApplicationRecord
GROUPS_COUNT = 7
GROUP_LENGTH = 5
belongs_to :user
belongs_to :buyer, class_name: "User", optional: true
scope :not_activated, -> { where(activated_at: nil) }
scope :activated, -> { where.not(activated_at: nil) }
@byteg
byteg / api.php
Created June 14, 2019 12:03
Like4u Vk API example
<?php
$url = "https://vk.com/feed?w=wall-72973891_77233";
$token = "";
$postdata = array("token" => $token,
"task" => array(
"kind" => "1",
"title" => "SOME TITLE",
"url" => $url,
"members_count" => "111",
"cost" => "1",
@byteg
byteg / sidekiq.yml
Created November 30, 2017 10:29
Block queues
:queues:
- default
- load_files
- copy_files
:blocking:
- load_files
@byteg
byteg / gist:fd50433f73866d71ac1168fd0687c7e4
Created December 23, 2016 11:48
Rails 5 crashing on Rubinius
rails s
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
E, [2016-12-23T14:40:25.617800 #19112] ERROR -- : run() in thread failed: undefined method `read_only_buffer' on an instance of IO::FileDescriptor.:\n core/zed.rb:1413:in `read_only_buffer (method_missing)'
core/io.rb:2795:in `read_if_available'
core/io.rb:2852:in `read_nonblock'
core/io.rb:2995:in `readpartial'
/home/denisk/.rvm/gems/rbx-head/gems/rb-inotify-0.9.7/lib/rb-inotify/notifier.rb:300:in `readpartial'
/home/denisk/.rvm/gems/rbx-head/gems/rb-inotify-0.9.7/lib/rb-inotify/notifier.rb:271:in `read_events'