Skip to content

Instantly share code, notes, and snippets.

View qd3v's full-sized avatar
Working from home

Ivan Kulagin qd3v

Working from home
View GitHub Profile
qd3v / clion
Last active July 2, 2024 18:25
Jetbrains force us to use their Toolbox to get working CLI launchers in recent versions of standalone apps. I don't like that, and save these scripts. Drop these to /usr/local/bin
#!/usr/bin/env python3
# Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
import os
import socket
import struct
import sys
import traceback
# See com.intellij.idea.SocketLock for the server side of this interface.
module SpecHelpers
# See more on this:
module VCRHooks
# @return [Proc] registered proc
def register_vcr_hook(type, *args, &block)
# Do not use #hooks hash directly, VCR wrap block into FilteredHook struct
VCR.configuration.send(type, *args, &block); block
qd3v / only_ar_rspec-rails_import.rb
Last active August 29, 2015 14:26
If you need only use_transactional_fixtures option
# Gemfile
gem 'rspec-rails', require: false
# spec_helper.rb
require 'rspec/rails/adapters'
# spec_helper.rb
require 'nokogiri'
require 'equivalent-xml/rspec_matchers'
RSpec.configure do |config|
# Should be used with be_equivalent_to provided by 'equivalent-xml' gem
# @see
# @see
def xml_document(&block)
require 'bundler/gem_tasks'
require 'active_record'
# Temporary switch to blank rake app, extract required tasks and import them to
# current rake task. Skip seed loader here, as we do not need it for tests.
# More info on AR tasks import: @see
def import_active_record_tasks(default_rake_app)
Rake.application =
qd3v / timecop.rb
Created December 24, 2014 14:58
Timecop explained
t = Time.local(2008, 9, 1, 10, 5, 0)
# Self-explained
Timecop.freeze(t) do
expect( eq 0
# The same as above
expect( eq 0