Kernel's function with arity | BeautyKernel's alias |
---|---|
!=/2 | not_eq? |
*/2 | multiply |
++/2 | list_concat |
+/1 | plus |
+/2 | plus |
--/2 | list_remove |
-/1 | minus |
-/2 | minus |
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
select Value+CHAR(32) from Table | |
for xml path('') |
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
Is a table containing identifiers and the vertex coordinates of figures. | |
P (Polygon_id int, point_id int, x float, y float) | |
Points are listed sequentially in a clockwise or counter- clockwise | |
1. It is necessary to write a function that returns the area of a selected polygon | |
2. It is necessary to write a function that returns the perimeter of the selected polygon | |
3. Check whether the point is on the specified coordinates inside the polygon |
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
def brackets_balanced?(s) | |
brackets = [['(',')'],['[',']'],['{','}']] | |
flatten_brackets = brackets.flatten | |
close_brackets = brackets.map{|e| e[1]} | |
stack = '' | |
for i in 0..s.size do | |
stack += s[i] if flatten_brackets.include?(s[i]) | |
stack = stack[0,stack.size-2] if brackets.include? [stack[stack.size-2,1],stack[stack.size-1,1]] | |
return false if close_brackets.include? stack[stack.size-1,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
# test for Flatstack | |
# https://github.com/fs/test-tasks/tree/master/ruby | |
# Дана последовательность: | |
# 1 | |
# 11 | |
# 21 | |
# 1211 | |
# 111221 | |
# 312211 | |
# Нужно чтобы ваша программа могла продолжить данную последовательность. Можете в реализации использовать любые библиотеки. |
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
/* | |
Making btree_gin index and using it in search | |
*/ | |
CREATE EXTENSION btree_gin; | |
create index ix_table_1 on table_1 USING GIN (to_tsvector('simple', coalesce(table_1.seach_field.value::text, '')), table_1.id) | |
select * from table_1 | |
where to_tsvector('simple', coalesce(table_1.seach_field.value::text, '')) @@ to_tsquery( 'example:*' ); | |
-- index used |
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
Array.prototype.eachSlice = function(size=1) { | |
return Array(Math.ceil(this.length / size)) | |
.fill() | |
.map(( _, idx) => { | |
return this.slice(idx * size, (1 + idx) * size) | |
}) | |
} |
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
..... | |
config :logger, :console, | |
level: :debug, | |
format: {LoggerFormatter, :format_log}, |
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
# For MacOS and "Postgres" App Users | |
# where var-10 is version of postgreSQL | |
cd /Users/$USER/Library/Application\ Support/Postgres/var-10/ | |
rm postmaster.pid | |
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
defmodule Dynamic do | |
@methods ~w(method1 method2 method3)a | |
@methods | |
|> Enum.each( fn method -> | |
method_name = "prefix_#{method}" | |
def unquote(:"#{method_name}")(argument1, argument2) do | |
{unquote(method), argument1, argument2} | |
end | |
end) |
OlderNewer