Skip to content

Instantly share code, notes, and snippets.

View alsemyonov's full-sized avatar
🏠
Working from home

Alex Semyonov alsemyonov

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am alsemyonov on github.
  • I am alsemyonov (https://keybase.io/alsemyonov) on keybase.
  • I have a public key ASA_smnNB0ZUPzAQzkxZKLUeng046rr4yqaxcGSDOZ2rPgo

To claim this, I am signing this object:

@alsemyonov
alsemyonov / amqp.rb
Created September 14, 2013 07:53 — forked from dakatsuka/amqp.rb
# config/initializers/amqp.rb
require 'amqp/utilities/event_loop_helper'
require 'amqp/integration/rails'
module AMQPManager
def self.start
AMQP::Utilities::EventLoopHelper.run
AMQP::Integration::Rails.start do |connection|
connection.on_error do |ch, connection_close|
raise connection_close.reply_text
@alsemyonov
alsemyonov / mongoid_sti_scopes_exception.rb
Created February 15, 2011 04:30
Mongoid STI scopes exception
require 'rubygems'
require 'mongoid'
connection = Mongo::Connection.new
Mongoid.config.database = Mongo::DB.new('example', connection)
class A
include Mongoid::Document
field :foo, :type => Integer
@alsemyonov
alsemyonov / telepathy_retrieving_contacts_example.py
Created April 23, 2009 23:08
requesting contacts from Telepathy
import telepathy
import telepathy.client
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from telepathy.constants import (
CONNECTION_HANDLE_TYPE_CONTACT, CONNECTION_HANDLE_TYPE_LIST,
CHANNEL_TEXT_MESSAGE_TYPE_NORMAL)
from telepathy.interfaces import (
@alsemyonov
alsemyonov / activerecord_reset_subclass_fix.rb
Last active August 30, 2015 04:15
fix for create_time_zone_conversion_attribute? problem
# lib/activerecord_reset_sublass_fix.rb
module ActiveRecord
class Base
def self.reset_subclasses #:nodoc:
@@subclasses = {}
subclasses.each do |subclass|
next unless ActiveSupport::Dependencies.autoloaded?(subclass)
(@@subclasses[subclass.superclass] ||= []) << subclass
end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<title>Формачке</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script>
$(function() {
$('#solve_1').click(function() {
if ($('#question_1_1').is(':checked')) {
$("#result").append("<div><p>Правильно!</p></div>");
@alsemyonov
alsemyonov / wacom_switcher.sh
Created October 5, 2008 22:35
Xorg configuration with and without Wacom Bamboo One
alias enable_wacom='sudo cp /home/rotuka/Code/sources/wacom/wacom-switcher/xorg.with.wacom.conf /etc/X11/xorg.conf'
alias disable_wacom='sudo cp /home/rotuka/Code/sources/wacom/wacom-switcher/xorg.with.no.wacom.conf /etc/X11/xorg.conf'