Skip to content

Instantly share code, notes, and snippets.

View akzhan's full-sized avatar

Akzhan Abdulin akzhan

View GitHub Profile
Bluepill.application("app", :base_dir => "#{RAILS_ROOT}/tmp/bluepill", :log_file => "#{RAILS_ROOT}/log/bluepill.log") do |app|
app.process("unicorn") do |process|
process.pid_file = File.join(RAILS_ROOT, 'tmp/pids/unicorn.pid')
process.working_dir = RAILS_ROOT
process.start_command = "unicorn -c config/unicorn.rb -E production config.ru"
process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}"
process.uid = process.gid = 'www'
# unicorn_rails -c config/unicorn.rb -E production -D
working_directory File.join(File.dirname(File.expand_path(__FILE__)), '..')
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 4 : 1)
stderr_path "log/unicorn.stderr.log"
$('input:text').each(function()
{
var $this = $(this);
var id = $this.attr('id');
$this.replaceWith($('<textarea></textarea>').val($this.val()).attr('id', id);
});
$('textarea').wysisyg();
(function($)
{
$('.timepick').timeslider();
})(jQuery);
var body = [];
var body_length = 0;
sourceResponse.on('data', function(chunk)
{
body.push(chunk);
body_length += chunk.length;
});
sourceResponse.on('end', function()
{
@akzhan
akzhan / access.theme.rb
Created October 19, 2010 09:21
How to use hash as getters and setters
class PropertyHash < Hash
def method_missing(name, *args, &block)
return self[name.to_s] if include?(name.to_s) && args.size == 0
return !!self[$1] if name.to_s =~ /^(.+)\?$/ && include?($1) && args.size == 0
if name.to_s =~ /^(.+)\=$/ && include?($1) && args.size == 1
self[$1] = args.first
return
end
super
end
7ccc3b4 [5 days ago] (Mike Burns) Fix resizing bug with the editor WYSIWYG
diff --git a/public/javascripts/jquery.wysiwyg.js b/public/javascripts/jquery.wysiwyg.js
index 37ae000..961398b 100644
--- a/public/javascripts/jquery.wysiwyg.js
+++ b/public/javascripts/jquery.wysiwyg.js
@@ -1327,26 +1327,6 @@
.mousedown(function () { self.autoSaveFunction(); })
.bind($.support.noCloneEvent ? "input.wysiwyg" : "paste.wysiwyg", function () { self.autoSaveFunction(); });
}
@akzhan
akzhan / WizardSample.pm
Created October 29, 2012 07:03
пример визарда
package FrontOffice::Controller::WizardSample;
=encoding windows-1251
=head1 NAME
FrontOffice::Controller::WizardSample
=cut
package AkzhanAbdulinFindIndex;
use warnings;
use strict;
use List::BinarySearch qw( binsearch_pos );
sub new {
my ( $class ) = @_;
@akzhan
akzhan / habraproxy.py
Last active June 23, 2016 12:52 — forked from anonymous/habraproxy.py
just for fun, not tested :)
# habraproxy.py — это простейший http-прокси-сервер, запускаемый локально (порт на ваше
# усмотрение), который показывает содержимое страниц Хабра. С одним исключением: после
# каждого слова из шести букв должен стоять значок «™». Примерно так:
#
# http://habrahabr.ru/company/yandex/blog/258673/
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Сейчас на фоне уязвимости Logjam все в индустрии в очередной раз обсуждают проблемы и
# особенности TLS. Я хочу воспользоваться этой возможностью, чтобы поговорить об одной из
# них, а именно — о настройке ciphersiutes.
#