This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# The program e is a command line utility that extracts lots of | |
# different archives. It is very simple and can be extended very easily. | |
# | |
# It is inspired by how firewall use their rulesets, and works like this: | |
# | |
# * For each file that has to be extracted, the rules are matched one after the other. | |
# * When a rule matches (either by the filetype or filename), the command is executed. | |
# * If the command does not return an error code the extraction is considered successful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'libnotify' | |
require 'getoptlong' | |
parser = GetoptLong.new | |
parser.set_options(["-s", "--summary", GetoptLong::REQUIRED_ARGUMENT], | |
["-b", "--body", GetoptLong::REQUIRED_ARGUMENT], | |
["-i", "--icon_path", GetoptLong::REQUIRED_ARGUMENT] | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<h2>inner</h2> | |
<script> | |
jQuery(function() { | |
if ('parent' in window && window != window.parent && 'postMessage' in window.parent) { | |
window.parent.postMessage('page_change:20', '*'); | |
} | |
}); | |
$(window).bind('message', function(e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://readmanga.ru/js/jquery/jquery-1.4.3.min.js"></script> | |
<h2>inner</h2> | |
<script> | |
function notify_parent(message) { | |
if ('parent' in window && window != window.parent && 'postMessage' in window.parent) { | |
window.parent.postMessage(message, '*'); | |
} | |
} | |
jQuery(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//----------------------------------------------------------------------------- | |
#include <windows.h> | |
//----------------------------------------------------------------------------- | |
//#define __TEST__ | |
//----------------------------------------------------------------------------- | |
#ifndef __TEST__ | |
#pragma comment(linker,"/MERGE:.rdata=.text") | |
//#pragma comment(linker,"/FILEALIGN:512 /SECTION:.text,EWRX /IGNORE:4078") | |
#pragma comment(linker,"/ENTRY:WinMain") | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
group :test, :development do | |
gem 'debugger'#, :git => 'git://github.com/cldwalker/debugger.git' | |
#gem 'ruby-debug19', :require =>'ruby-debug' | |
gem 'rspec-rails' | |
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git' | |
gem 'launchy' | |
gem 'shoulda' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
class Recommendations::Metrics::MetricBase | |
# элемент в списке, но без оценки | |
NotRated = -1 | |
def initialize(klass) | |
@klass = klass | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Recommendations::Metrics::Euclid < Recommendations::Metrics::MetricBase | |
def compare(user_id, user_rates, sampler_id, sampler_rates) | |
return 0 unless user_rates && sampler_rates | |
shared_ids = user_rates.keys & sampler_rates.keys | |
return 0 if shared_ids.empty?# || shared_ids.size < MinimumShared | |
# сумма квадратов разницы | |
sum_of_squares = shared_ids.sum do |id| | |
(user_rates[id] - sampler_rates[id])**2 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Recommendations::Metrics::Pearson < Recommendations::Metrics::MetricBase | |
def compare(user_id, user_rates, sampler_id, sampler_rates) | |
return 0 unless user_rates && sampler_rates | |
shared_ids = user_rates.keys & sampler_rates.keys | |
return 0 if shared_ids.empty?# || shared_ids.size < MinimumShared | |
sum1 = sum2 = sum1Sq = sum2Sq = pSum = 0.0 | |
shared_ids.each do |id| | |
prefs1_item = user_rates[id] || 0.0 |
OlderNewer