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
%%% | |
%%% Debian ejabberd configuration file | |
%%% This config must be in UTF-8 encoding | |
%%% | |
%%% The parameters used in this configuration file are explained in more detail | |
%%% in the ejabberd Installation and Operation Guide. | |
%%% Please consult the Guide in case of doubts, it is available at | |
%%% /usr/share/doc/ejabberd/guide.html | |
%%% This configuration file contains Erlang terms. |
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
def logA( x, a ) | |
return (Math.log(x)/Math.log(a)) | |
end | |
def print_row(teams) #просто выводит команды на какомто этапе | |
teams.each_slice(2) do |team1, team2| | |
print team1.to_s + '-' + team2.to_s + " " | |
end | |
puts |
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
#################################Тестирование################################# | |
def print_row(teams) #просто выводит команды на какомто этапе | |
teams.each_slice(2) do |team1, team2| | |
print team1.to_s + '-' + team2.to_s + " " | |
end | |
puts | |
end | |
def random_play(team1,team2) |
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
require 'amqp' | |
require 'em-websocket' | |
class Websockets | |
def self.publisher(message = "Hello world!"+Time.now.to_s, routing_key = "amqp.test") #routing_key will contain current_user.id | |
#connect to rabbitmq service, open channel, create queue | |
AMQP.start("amqp://localhost") do |connection| # connection is open and ready to be used | |
channel = AMQP::Channel.new(connection) |
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
require 'amqp' | |
require 'em-websocket' | |
class Websockets | |
def self.publisher(message = "Hello world!"+Time.now.to_s, routing_key = "amqp.test") #routing_key will contain current_user.id | |
#connect to rabbitmq service, open channel, create queue | |
AMQP.start("amqp://localhost") do |connection| # connection is open and ready to be used | |
channel = AMQP::Channel.new(connection) |
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 UpdateTeamRatingsFromTeamScores < ActiveRecord::Migration | |
def up | |
rating = Rating.by_alias('starladder') | |
Team.all.each do |team| | |
prev_tscore = team.team_scores.first | |
current_team_rating = nil | |
team.team_scores.each_with_index do |tscore, index| |
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
require 'nokogiri' | |
file = File.open("/home/neox/Desktop/test") | |
doc = Nokogiri::HTML(file) | |
rows = doc.css('tbody tr') | |
rows.each do |row| | |
name = row.at_xpath('td[2]/a/text()').to_s.strip |
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
<?php | |
$birth_date = htmlentities($_GET['birth_date']); | |
if (preg_match("/([0-9]{2})\.([0-9]{2})\.([0-9]{4})/", $birth_date) === 0) | |
$error = 'Неправильный формат даты.'; | |
#$birth_date = '21.04.1991'; | |
$date = []; | |
list($date['day'], $date['month'], $date['year']) = explode('.', $birth_date); |
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 OneOnOne::ConversationManager | |
attr_reader :session, :limit, :offset, :timestamp | |
LIMIT = 5 | |
def initialize(session, options = {}) | |
@session = session | |
@limit = options[:limit].present? ? options[:limit].to_i : LIMIT | |
@offset = options[:offset].present? ? options[:offset].to_i : 0 | |
@timestamp = options[:timestamp].present? ? Time.at(options[:timestamp].to_i) : nil |
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
/*Message*/ | |
{ | |
"body": "bw", | |
"created_at": "2016-07-12T08:28:58Z", | |
"id": 60, | |
"user": { | |
"id": 1, | |
"avatar_url": null, | |
"full_name": "Darwin Lueilwitz" | |
}, |
OlderNewer