Skip to content

Instantly share code, notes, and snippets.

View asavartsov's full-sized avatar

Aleksei Savartsov asavartsov

  • Helsinki, Finland
View GitHub Profile
using System;
using System.Net.Sockets;
using Media.Rtsp;
namespace RtspAuthTest
{
class SafeRtspClient : RtspClient
{
public SafeRtspClient(Uri location, ClientProtocolType? rtpProtocolType = null, int bufferSize = DefaultBufferSize, Socket existing = null, bool leaveOpen = false, int responseTimeoutInterval = (int)Media.Common.Extensions.TimeSpan.TimeSpanExtensions.MicrosecondsPerMillisecond)
: base(location, rtpProtocolType, bufferSize, existing, leaveOpen, responseTimeoutInterval)
@asavartsov
asavartsov / sweeping.rb
Created March 17, 2012 10:52
Cache Sweeper for Mongoid
# 2. Include Sweeping module in your controller(s) to have cache_sweeper
# method to be avaliable, or right in ApplicationController so it will be
# available in all controllers inheriting from it.
class ApplicationController < ActionController::Base
include ActionController::Caching::Sweeping
# ...
end
@asavartsov
asavartsov / Gemfile
Created February 17, 2012 16:49
Mongoid 3.0, Paperclip, embedded, accepts_nested_attributes_for and allow_destroy with optional description
gem 'rails', '3.2.1'
gem 'mongoid', :git => 'git://github.com/mongoid/mongoid.git'
gem 'mongoid-paperclip', :require => "mongoid_paperclip"
# if you're using rspec (should be temporary until mongoid-rspec will be updated to mongoid 3.0)
# group :test do
# gem "mongoid-rspec", :git => 'https://github.com/tanordheim/mongoid-rspec.git', :branch => 'mongoid_3_0'
# end
@asavartsov
asavartsov / gist:1816909
Created February 13, 2012 13:10
API 2GIS: Отключение зума по колесику с сохранением прокрутки страницы
map.disableScrollZoom();
if($.browser.mozilla) {
map.addEventListener(map.getContainerId(), 'DgMouseWheel', function(e) {
window.handleEvent(e.windowEvent);
});
}
else {
window.onmousewheel = document.onmousewheel = null;
}