Skip to content

Instantly share code, notes, and snippets.

Akzhan Abdulin akzhan

Block or report user

Report or block akzhan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AkzhanAbdulinFindIndex.pm
package AkzhanAbdulinFindIndex;
use warnings;
use strict;
use List::BinarySearch qw( binsearch_pos );
sub new {
my ( $class ) = @_;
@akzhan
akzhan / WizardSample.pm
Created Oct 29, 2012
пример визарда
View WizardSample.pm
package FrontOffice::Controller::WizardSample;
=encoding windows-1251
=head1 NAME
FrontOffice::Controller::WizardSample
=cut
View gist:960576
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 / access.theme.rb
Created Oct 19, 2010
How to use hash as getters and setters
View access.theme.rb
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
View retrieve-http-utf8.js
var body = [];
var body_length = 0;
sourceResponse.on('data', function(chunk)
{
body.push(chunk);
body_length += chunk.length;
});
sourceResponse.on('end', function()
{
View inputs-thru-textareas-to-jwysiwyg.js
$('input:text').each(function()
{
var $this = $(this);
var id = $this.attr('id');
$this.replaceWith($('<textarea></textarea>').val($this.val()).attr('id', id);
});
$('textarea').wysisyg();
View gist:451067
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'
View Unicorn config example
# 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"
View chef-client.0.8.10.CHEF-1161.patch
--- lib/chef/rest.rb 2010-05-19 14:25:18.000000000 +0400
+++ lib/chef/rest.rb 2010-05-19 14:26:57.000000000 +0400
@@ -178,23 +178,20 @@
end
http.read_timeout = Chef::Config[:rest_timeout]
+ json_body = data ? data.to_json : nil
headers = @default_headers.merge(headers)
-
You can’t perform that action at this time.