This file contains hidden or 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 Array | |
def complect(n) | |
each_slice((length.to_f / n).ceil).map {|a| a.inject(:+)} | |
end | |
end |
This file contains hidden or 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
# Nginx+Unicorn best-practices congifuration guide. | |
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
# | |
# Deployment structure | |
# | |
# SERVER: | |
# /etc/init.d/nginx (1. nginx) | |
# /home/app/public_html/app_production/current (Capistrano directory) | |
# |
This file contains hidden or 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
create or replace | |
function get_ref_name( | |
num_n_ref_id si_ref.n_ref_id%type, | |
num_n_lang_id si_ref.n_lang_id%type := sys_context('MAIN', 'N_LANG_ID') | |
) | |
return si_ref.vc_name%type | |
is | |
vch_vc_name si_ref.vc_name%type; | |
begin | |
select nvl(l.vc_name, r.vc_name) |
This file contains hidden or 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
module ClientsStuff | |
class Hupo < ::Rails::Engine | |
delegate :application, to: :Rails | |
initializer 'clients_stuff.hupo.append_assets' do | |
append_paths('assets') | |
end | |
initializer 'clients_stuff.hupo.append_widgets_paths', before: 'hupo_widget.load_all_widgets' do | |
append_paths('widgets') |
This file contains hidden or 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
create or replace function concat_strings ( | |
c_list sys_refcursor) | |
return varchar2 | |
as | |
vch_result varchar2(4000); | |
vch_string varchar2(4000); | |
begin | |
loop | |
fetch c_list into vch_string; | |
exit when c_list%notfound; |
This file contains hidden or 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 Object | |
# class MyObject | |
# end | |
# | |
# obj = MyObject.new | |
# obj.ring_it! # Start tracking | |
# # Logs will appear in rails log (tweak as you wish) | |
# # Do not use in production! Only for debug | |
def ring_it! | |
return if @__ringed__ |
This file contains hidden or 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
CREATE OR REPLACE FUNCTION parse_ipv6(src varchar2) | |
RETURN RAW | |
AS LANGUAGE JAVA | |
NAME 'sun.net.util.IPAddressUtil.textToNumericFormatV6(java.lang.String) return java.lang.Byte[]'; | |
/ | |
begin | |
dbms_output.put_line(rawtohex(parse_ipv6('::1'))); | |
end; | |
/ |
This file contains hidden or 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
before_save :check_comment_size, if: :max_comment_size | |
class << self | |
def max_comment_size | |
return @max_comment_size if defined? @max_comment_size | |
@max_comment_size = comment_field.try(:[], :data_length) | |
end | |
def comment_field | |
put_procedure = procedure_methods[:put][:procedure] |
This file contains hidden or 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
recursive_lambda = proc {|h, k| h[k] = Hash.new(&recursive_lambda)} | |
Hash.new(&recursive_lambda) |
This file contains hidden or 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
CREATE TABLE invoices ( | |
id NUMBER PRIMARY KEY, | |
strategy_id NUMBER | |
); | |
CREATE OR REPLACE TYPE base_strategy AS OBJECT ( | |
id number, | |
not final member procedure do(d date) | |
) NOT FINAL; | |
/ |
OlderNewer