Skip to content

Instantly share code, notes, and snippets.

View sclinede's full-sized avatar

Sara Dolganov sclinede

View GitHub Profile
private void newMessageHandler(object _sender, NewMessageEventArgs e)
{
// Здесь вы можете обработать данное событие, e.Text - содержит текст сообщения
}
//... где-то в коде ...
//... там где вы инициализируете общение между желающими ...
Communicator MyCom = new Communicator(localPort, destIp, destPort); // Параметры, соответственно: порт для входящих соединений (1), IP того с кем связываемся (2),
// порт входящих соединений того с кем связываемся (3)
Долганов С.С., текущие задачи:
- Задача 1 (срок к дд.мм.гггг):
Небольшое описание, коментарии и проч.
- Задача 2 (срок к дд.мм.гггг):
Другое описание и бла-бла-бла.
@sclinede
sclinede / product_name.rb
Last active August 29, 2015 14:01
nice product name decorator
def product_info
product_name_reg = /^#{I18n.t('pages.dashboard.messages.order.new', product: '(.*)', amount: '(.*)', price: '(.*)')}$/
total_reg = /^#{I18n.t('pages.dashboard.messages.order.total', total: '')}(.*)$/
product_name = content.match(product_name_reg).try(:[], 1)
total = content.match(total_reg).try(:[], 1)
result = total.present? ? '%s (%s)' : '%s'
result % [product_name, total]
end
@sclinede
sclinede / recalc_company_rating.rb
Last active August 29, 2015 14:01
Recalculate Company Rating for Company
company_id = 11973147
wrong_field = :active_reviews_count
# before
CoreDenormalization::Fields::Company::Reviews.value_as_string(object: company_id, field: wrong_field)
sql_for_data = initialize_statement # with company_id filter
data = ActiveRecord::Base.connection.execute sql_for_data
hash_with_object_key = {data.delete(:object_id) => data}
CoreDenormalization::Fields::Company::Reviews.instance.write_data hash_with_object_key
def reload_companies_products(*ids)
Company.find(ids).each do |company|
company.products.find_each { |prod| prod.transmitter_update }
CompaniesSweeper.expire(company)
end
end
/*
* Обработка событий для YML на СК
*
*/
app.modules.companyYmlAction = (function(self) {
var
$clickedButton;
function _getContentForPopup(options) {
# coding: utf-8
class MeasureUnitCache
include Singleton
def self.find_similar_to_name(name)
instance.data[name]
end
private
# coding: utf-8
class CreateCompanyStatisticsExpModels < Core::Migration
def self.up
with_connection Statistics::DbBase.connection do
Statistics::DbBase.transaction do
execute "CREATE SCHEMA statistics_exp"
create_master_table("statistics_exp.company_statistic_geo_by_months") do |t|
t.integer :company_id, :null => false
t.date :date, :null => false
date = Date.parse('2014-07-31')
week = CoreStatistics::Base.new.get_week_by_date(date)
CompanyStatisticLog.transaction do
CompanyStatisticPagesByMonth.process date
CompanyStatisticReferersByWeek.process week
CompanyStatisticReferersByMonth.process date
CompanyEventLog.clear_if_needed
end
/*****************************************************************/
/* BIFF-stream (excel file) parsing */
/* */
/* This file is part of catdoc project */
/* (c) David Rysdam 1998 */
/* (c) Victor Wagner 1998-2003, (c) Alex Ott 2003 */
/*****************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif