Skip to content

Instantly share code, notes, and snippets.

View vsevolod's full-sized avatar
🏇
boosting

Avramov Vsevolod vsevolod

🏇
boosting
  • Russia, Saint-Petersburg
View GitHub Profile
@vsevolod
vsevolod / replace_create_to_build_stubbed.rb
Last active August 21, 2020 16:22
Best success version spec files with build_stubbed instead of create
require_relative 'spec/spec_helper.rb'
require 'pry-byebug'
class SpecFile
CREATE = ' create(:'.freeze
BUILD_STUBBED = ' build_stubbed(:'.freeze
attr_reader :file_name, :content_array
def initialize(file_name)
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'mongoid'
gem 'benchmark'
gem 'pry-byebug'
end
class A
@vsevolod
vsevolod / some.js
Created October 25, 2019 18:49
BlackList youtube trends channels (Greasemonkey script)
// ==UserScript==
// @name Blacklist Youtube Channels
// @version 1
// @grant GM.setValue
// @grant GM.getValue
// @include https://www.youtube.com/*
// ==/UserScript==
const blacklistChannelName = 'BlacklistYoutubeChannels';
var channels = [];
@vsevolod
vsevolod / one_app.rb
Last active October 1, 2019 16:07
Try to repeat error for mongoid7
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'mongoid', '~> 7.0'
gem 'mongoid_relations_dirty_tracking', github: 'tablecheck/mongoid_relations_dirty_tracking'
gem 'pry-byebug'
end
Mongoid.configure do |config|
FROM ruby:2.5
ENV LANG="C.UTF-8" \
APP_HOME="/app" \
BUNDLE_SILENCE_ROOT_WARNING="1"
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
@vsevolod
vsevolod / sort.rb
Created April 16, 2018 14:36
Bubble sorting
class BubbleArray < Array
def sort
dup.sort!
end
def sort!
return self if self.size <= 1
for i in 0...size
swapped = false
x=0;$.each($('table tbody td:nth-child(6)'), function(index, el){var n=Number($(el).text());if(n<100) x=x+n});x