Началось все 2 декабря. РосКомНадзор. Заблокировал сайт github.com о чем сообщил в
У меня github выпал из бана только ночю 4 декабря.
А спустя некторое время мне попалась
Началось все 2 декабря. РосКомНадзор. Заблокировал сайт github.com о чем сообщил в
У меня github выпал из бана только ночю 4 декабря.
А спустя некторое время мне попалась
|
var casper = require('casper').create(); var k_word = ""; var k_words = [ "тест", "поиск", "Программы для парсинга", ] casper.start('http://www.yandex.ru/', function() { this.wait(getRandomInterval(700, 2000), function() { this.echo("load yandex"); }); }); for(var i, i=0; i<k_words.length; i++ ){ casper.then(function() { this.wait(getRandomInterval(700, 2000), function() { k_word = k_words.shift(); this.sendKeys('input[name="text"]', k_word); }); }); casper.then(function() { this.wait(getRandomInterval(700, 2000), function() { this.click('button[type="submit"]'); this.echo("start find"); }); }); casper.then(function() { casper.waitForSelector('.serp-block', function() { this.echo('find in yandex'); this.capture(k_word + " " + 'yandex.png'); }); }); casper.then(function() { this.wait(getRandomInterval(1000, 2000), function() { this.click('.input__clear_visibility_visible'); }); }); } casper.run(); function getRandomInterval(min, max) { return Math.random() * (max - min) + min; }
<ul> ...... <li data-youtubeid='<?= $v["youtube_id"] ?>'> <a href="<?= $v["link"] ?>"> <img src="//img.youtube.com/vi/<?= $v["youtube_id"] ?>/0.jpg" alt="" width="237px"> </a> <div class="youtube_title"><a href="#"></a></div> <div class="author"></div> <div class="counter"><span></span> просмотров<div class="youtube_date"></div></div> </li> ...... </ul> <script> (function($) { $(function () { $(".yotube-list li").each(function() { var thisli = $(this); var data_create = new Date(); $.getJSON('http://gdata.youtube.com/feeds/api/videos/' + $(this).attr("data-youtubeid") + '?alt=json', function (data) { thisli.find(".youtube_title a").text(data.entry.title.$t); thisli.find(".author").text(data.entry.author[0].name.$t); thisli.find(".counter span").text(data.entry.yt$statistics.viewCount.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ')); var date = new Date(Date.parse(data.entry.updated.$t)); thisli.find(".youtube_date").text(date.format("dd.MM.yyyy").toString()); }); }); //https://gdata.youtube.com/feeds/api/videos/GrbUbVHSpzw?v=2&alt=json }); })(jQuery); </script> </section>
<asp:Repeater runat="server" ID="ImageForSlider" DataSource='<%# Eval("ImageForSlider")%>'> <ItemTemplate> <img src="<%# Eval("Url") %>" width="592" height="312" /> </ItemTemplate> </asp:Repeater>
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking country-coder.blogspot.ru (be patient) Completed 200 requests Completed 400 requests Completed 600 requests Completed 800 requests Completed 1000 requests Completed 1200 requests Completed 1400 requests Completed 1600 requests Completed 1800 requests Completed 2000 requests Finished 2000 requests Server Software: GSE Server Hostname: country-coder.blogspot.ru Server Port: 80 Document Path: / Document Length: 208432 bytes Concurrency Level: 10 Time taken for tests: 65.455 seconds Complete requests: 2000 Failed requests: 1202 (Connect: 0, Receive: 0, Length: 1202, Exceptions: 0) Write errors: 0 Non-2xx responses: 1202 Total transferred: 167209285 bytes HTML transferred: 166522258 bytes Requests per second: 30.56 [#/sec] (mean) Time per request: 327.275 [ms] (mean) Time per request: 32.728 [ms] (mean, across all concurrent requests) Transfer rate: 2494.69 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 24 30 12.7 28 523 Processing: 161 295 201.5 173 4255 Waiting: 161 191 138.4 173 4255 Total: 186 325 203.6 205 4280 Percentage of the requests served within a certain time (ms) 50% 205 66% 400 75% 453 80% 468 90% 527 95% 636 98% 679 99% 911 100% 4280 (longest request)
class Clientsale < ActiveRecord::Base attr_accessible :comment, :company_name, :dolznost, :email, :fio, :phone, :project_id, :url_name, :user_id #validates :email, email_format: { message: "Ошибка при вводе email", allow_nil: true, allow_empty: true } validates_each :email, :phone do |record, attr, value| record.errors.add(attr, 'Хотя бы один контакт должен быть указан') if $test_clientsale_00163563213_find_me_in_def_contact_test.empty? end validates_each :company_name, :url_name do |record, attr, value| record.errors.add(attr, 'Хотя бы один параметр (Адрес сайта или Название компании) ') if $test_url_and_name_company_56456456__find_me_in_def_contact_test.empty? end before_validation :contact_test before_save :set_user_project private def contact_test $test_clientsale_00163563213_find_me_in_def_contact_test = self.phone.to_s + self.email.to_s $test_url_and_name_company_56456456__find_me_in_def_contact_test = self.company_name.to_s + self.url_name.to_s end def set_user_project self.user_id = User.current.id project = Project.new project.name = "text" project.identifier = "project" + generate_sufix self.project_id = project.id if project.save end def generate_sufix Time.new.to_i.to_s + Random.new.rand(1_000_000..9_999_999).to_s end end
casper.test.begin('Тест title на /2014/07/redmine_30.html', 1, function suite(test) { casper.start("http://country-coder.blogspot.ru/2014/07/redmine_30.html", function() { test.assertTitle("Блог сельского программиста: откат миграций для плагинов redmine", "ОК"); }); casper.run(function() { test.done(); }); }); casper.test.begin('Тест title на /2014/07/redmine_25.html', 1, function suite(test) { casper.start("http://country-coder.blogspot.ru/2014/07/redmine_25.html", function() { test.assertTitle("Блог сельского программиста: redmine ошибка в хроме", "ОК"); }); casper.run(function() { test.done(); }); }); casper.test.begin('Тест title на /2014/07/redmine.html', 1, function suite(test) { casper.start("http://country-coder.blogspot.ru/2014/07/redmine.html", function() { test.assertTitle("Блог сельского программиста: написание плагинов для redmine перевод", "ОК"); }); casper.run(function() { test.done(); }); });Запускаем casperjs test t_blog.js соответственно
function addInputFiles(inputEl) {
$(inputEl).attr('onchange', null);
clearedFileInput.insertAfter('#attachments_fields');
clearedFileInput.attr('onchange', 'addInputFiles(this);');
$ export RAILS_ENV="production"
$ export RAILS_ENV=production
$ ruby script/rails generate redmine_plugin Polls create plugins/polls/app create plugins/polls/app/controllers create plugins/polls/app/helpers create plugins/polls/app/models create plugins/polls/app/views create plugins/polls/db/migrate create plugins/polls/lib/tasks create plugins/polls/assets/images create plugins/polls/assets/javascripts create plugins/polls/assets/stylesheets create plugins/polls/config/locales create plugins/polls/test create plugins/polls/README.rdoc create plugins/polls/init.rb create plugins/polls/config/routes.rb create plugins/polls/config/locales/en.yml create plugins/polls/test/test_helper.rb
Redmine::Plugin.register :polls do name 'Polls plugin' author 'John Smith' description 'A plugin for managing polls' version '0.0.1' end
ruby script/rails generate redmine_plugin_model <plugin_name> <model_name> [field[:type][:index] field[:type][:index] ...]
$ ruby script/rails generate redmine_plugin_model polls poll question:string yes:integer no:integer create plugins/polls/app/models/poll.rb create plugins/polls/test/unit/poll_test.rb create plugins/polls/db/migrate/001_create_polls.rb
class CreatePolls < ActiveRecord::Migration def change create_table :polls do |t| t.string :question t.integer :yes, :default => 0 t.integer :no, :default => 0 end end end
$ rake redmine:plugins:migrate Migrating polls (Polls plugin)... == CreatePolls: migrating ==================================================== -- create_table(:polls) -> 0.0410s == CreatePolls: migrated (0.0420s) ===========================================
ruby script/rails console [rails 3] rails console >> Poll.create(:question => "Can you see this poll") >> Poll.create(:question => "And can you see this other poll") >> exit
class Poll < ActiveRecord::Base def vote(answer) increment(answer == 'yes' ? :yes : :no) end end
ruby script/rails generate redmine_plugin_controller <plugin_name> <controller_name> [<actions>]
$ ruby script/rails generate redmine_plugin_controller Polls polls index vote create plugins/polls/app/controllers/polls_controller.rb create plugins/polls/app/helpers/polls_helper.rb create plugins/polls/test/functional/polls_controller_test.rb create plugins/polls/app/views/polls/index.html.erb create plugins/polls/app/views/polls/vote.html.erb
class PollsController 'index' end end
<h2>Polls</h2> <% @polls.each do |poll| %> <p> <%= poll.question %>? <%= link_to 'Yes', { :action => 'vote', :id => poll[:id], :answer => 'yes' }, :method => :post %> (<%= poll.yes %>) / <%= link_to 'No', { :action => 'vote', :id => poll[:id], :answer => 'no' }, :method => :post %> (<%= poll.no %>) </p> <% end %>
get 'polls', :to => 'polls#index' post 'post/:id/vote', :to => 'polls#vote'
Redmine::Plugin.register :redmine_polls do [...] menu :application_menu, :polls, { :controller => 'polls', :action => 'index' }, :caption => 'Polls' end
menu(menu_name, item_name, url, options={})
Redmine::Plugin.register :redmine_polls do [...] permission :polls, { :polls => [:index, :vote] }, :public => true menu :project_menu, :polls, { :controller => 'polls', :action => 'index' }, :caption => 'Polls', :after => :activity, :param => :project_id end
def index @project = Project.find(params[:project_id]) @polls = Poll.find(:all) # @project.polls end
permission :view_polls, :polls => :index permission :vote_polls, :polls => :vote
class PollsController :index [...] def index @polls = Poll.find(:all) # @project.polls end [...] private def find_project # @project variable must be set before calling the authorize filter @project = Project.find(params[:project_id]) end end
"en": permission_view_polls: View Polls permission_vote_polls: Vote Polls
project_module :polls do permission :view_polls, :polls => :index permission :vote_polls, :polls => :vote end
a.vote { font-size: 120%; } a.vote.yes { color: green; } a.vote.no { color: red; }
<%= link_to 'Yes', {:action => 'vote', :id => poll[:id], :answer => 'yes' }, :method => :post, :class => 'vote yes' %> (<%= poll.yes %>) <%= link_to 'No', {:action => 'vote', :id => poll[:id], :answer => 'no' }, :method => :post, :class => 'vote no' %> (<%= poll.no %>)
<% content_for :header_tags do %> <%= stylesheet_link_tag 'voting', :plugin => 'polls' %> <% end %>
<% html_title "Polls" % >
class PollsHookListener < Redmine::Hook::ViewListener def view_projects_show_left(context = {}) return content_tag("p", "Custom content added to the left") end def view_projects_show_right(context = {}) return content_tag("p", "Custom content added to the right") end end
require_dependency 'polls_hook_listener'
class PollsHookListener "polls/project_overview" end
Redmine::Plugin.register :redmine_polls do [ ... ] settings :default => {'empty' => true}, :partial => 'settings/poll_settings' end
<table> <tbody> <tr> <th>Notification Default Address</th> <td><input type="text" id="settings_notification_default" value="<%= settings['notification_default'] %>" name="settings[notification_default]" > </tr> </tbody> </table>
require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')
require File.expand_path('../../test_helper', __FILE__) class PollsControllerTest 1 assert_response :success assert_template 'index' end end
$ rake db:drop db:create db:migrate redmine:plugins:migrate redmine:load_default_data RAILS_ENV=test
def test_index @request.session[:user_id] = 2 ... end
def test_index Role.find(1).add_permission! :my_permission ... end
def test_index Project.find(1).enabled_module_names = [:mymodule] ... end