Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Single

Andrey Voronkov Antiarchitect

💭
Single
View GitHub Profile
View hawkbit-pg.sql
-- ------------ Write DROP-FOREIGN-KEY-CONSTRAINT-stage scripts -----------
ALTER TABLE hawkbit.sp_action DROP CONSTRAINT fk_action_ds;
ALTER TABLE hawkbit.sp_action DROP CONSTRAINT fk_action_rollout;
@Antiarchitect
Antiarchitect / gist:143e40aaae463486bfc52b8bbf79e9d3
Last active July 3, 2018 09:44 — forked from barelyknown/gist:3692433
Send Email From Rails Console
View gist:143e40aaae463486bfc52b8bbf79e9d3
# Simple approach to sending email from the Rails console
# Implementation idea courtesy of Steve Klabnik
# http://blog.steveklabnik.com/posts/2012-09-09-random-ruby-tricks--class-new
# Create the mailer class with a block and assign to a variable
mailer = Class.new(ActionMailer::Base) do
def example_message
mail(to: "voronkovaa@gmail.com", from: "noreply@polarstern-staging.de", subject: "Example Message") do |format|
format.text { render text: "Example message body" }
end
View keybase.md

Keybase proof

I hereby claim:

  • I am Antiarchitect on github.
  • I am antiarchitect (https://keybase.io/antiarchitect) on keybase.
  • I have a public key whose fingerprint is 4F46 95F6 A181 72E9 FAC7 1C76 1462 D89E 01E7 7195

To claim this, I am signing this object:

@Antiarchitect
Antiarchitect / api_compatibility_checker.rb
Last active August 29, 2015 14:02
Api Compatibility Check
View api_compatibility_checker.rb
class ApiCompatibilityChecker
class CheckApiCompatibilityError < StandardError; end
SERVER_API_VERSION = '1.0.0'
VERSION_REGEXP = /\A(?<major>\d{1,5})\.(?<minor>\d{1,5})\.(?<patch>\d{1,5})\z/
attr_reader :request, :env
def initialize(request)
@Antiarchitect
Antiarchitect / application_controller.rb
Created May 11, 2012 08:42
Single entry point for many scopes in Devise.
View application_controller.rb
class ApplicationController < ActionController::Base
...
private
def after_sign_in_path_for(resource)
if current_administrator && current_administrator.is_admin?
[:admin, :admins]
else
root_path
@Antiarchitect
Antiarchitect / gist:1437892
Created December 6, 2011 11:36
Excluding commit
View gist:1437892
git checkout <last useful commit from bottom>
git checkout -b rescue
git merge master
git checkout master
git reset --hard <last useful commit from bottom>
git merge --interactive rescue
@Antiarchitect
Antiarchitect / gist:1428113
Last active September 28, 2015 10:57
VBoxManage help
View gist:1428113
VBoxManage --help
Oracle VM VirtualBox Command Line Management Interface Version 4.2.22
(C) 2005-2014 Oracle Corporation
All rights reserved.
Usage:
VBoxManage [<general option>] <command>
View devise.ru.yml
# Русский перевод для https://github.com/plataformatec/devise/tree/v1.4.7
# Другие переводы на http://github.com/plataformatec/devise/wiki/I18n
ru:
errors:
messages:
expired: "устарела. Пожалуйста, запросите новую"
not_found: "не найдена"
already_confirmed: "уже подтверждена. Пожалуйста, попробуйте войти в систему"
not_locked: "не заблокирована"
View edit_profile_spec.rb
require 'spec_helper'
describe "Edit profile process" do
before(:each) do
@user = Factory.create(:user)
@user.confirm!
@login_button = I18n.t("devise.sessions.new.submit")
@edit_button = I18n.t("devise.registrations.edit.submit")
@login_link = I18n.t("devise.menu.login_items.login")
@logout_link = I18n.t("devise.menu.login_items.logout")
View gist:926710
script_console_running = ENV.include?('RAILS_ENV') && IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
rails_running = ENV.include?('RAILS_ENV') && !(IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
irb_standalone_running = !script_console_running && !rails_running
if script_console_running
require 'logger'
Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT))
end