This file contains 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 Super.RepoTest do | |
use Super.DataCase, async: true | |
require Logger | |
@skipped_schemas [UserService.User] | |
defp tenant_schemas do | |
{:ok, mods} = :application.get_key(:super, :modules) | |
Enum.map(mods, fn mod -> |
This file contains 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
# Clean the database | |
DROP TABLE IF EXISTS _orders CASCADE; | |
DROP TABLE IF EXISTS _users CASCADE; | |
DROP TABLE IF EXISTS orders CASCADE; | |
DROP TABLE IF EXISTS users CASCADE; | |
# Build the database (for hard deletion) | |
CREATE TABLE users ( | |
id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, | |
name text NOT NULL |
This file contains 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 Procedure getRespWebService(pevc_url In Varchar2) Is | |
l_http_request utl_http.req; | |
l_http_response utl_http.resp; | |
l_response_text Clob; | |
l_content_type Varchar2(100); | |
l_IpAddress Varchar2(16); | |
l_Port Varchar2(10); | |
l_list json_list; | |
-- Variables del JSON de respuesta: | |
tipoDocumental Varchar2(200); |
This file contains 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
Declare | |
Type type_cursor Is Ref Cursor; | |
cu_query type_cursor; | |
lc_query Varchar2(500); | |
lc_codindic SFPS020T.codindic%Type; | |
lc_valindic SFPS020T.valindic%Type; | |
lc_desindic SFPS020T.desindic%Type; | |
Begin | |
lc_query := 'Select codindic, valindic, desindic'; | |
lc_query := lc_query||' From SFPS020T'; |
This file contains 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 procedure getInfoHTTP(pHost Varchar2 | |
,pPort Varchar2 | |
,pUrl Varchar2) is | |
req utl_http.req; | |
res utl_http.resp; | |
vResult CLOB; | |
begin | |
utl_http.set_transfer_timeout(30); | |
dbms_output.put_line('Request> URL: ' ||pUrl); | |
req := utl_http.begin_request(pUrl, 'GET', 'HTTP/1.1'); |
This file contains 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
instance_variable_set(name, value) # Nos permite definir y asignar un valor a una nueva variable de instancia | |
define_method(name, &block) # Nos permite definir dentro de la clase un método de manera dinámica y en tiempo de ejecución | |
method_missing(name, *args, &block) # Nos permite capturar y manejar la excepción que se dispara cuando llamamos un método no definido dentro de una clase. | |
... |
This file contains 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 MethodCatcher | |
def method_missing(name, *args, &block) | |
puts "El nombre del método no encontrado es #{name}" | |
puts "los argumentos del método son #{args}" | |
puts "El cuerpo del método es #{block.inspect}" | |
end | |
end | |
catch = MethodCatcher.new | |
catch.some_method(1, 2) { puts "something" } |
This file contains 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
code = "<?php \n" | |
code += " $x = 0; \n" | |
(1..3).each do |n| | |
code += " $x = $x + #{n}; \n" | |
end | |
code += " print($x); \n?>" | |
File.open("dummy.php", 'w') { |file| file.write(code) } |
This file contains 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 Example | |
end | |
ex = Example.new | |
ex.instance_variables # => [] | |
ex.instance_variable_set(:@x, 1) # => 1 | |
ex.instance_variables # => ["@x"] | |
ex.instance_variable_defined?(:@x) # => true | |
ex.instance_variable_defined?(:@y) # => false | |
ex.instance_variable_get(:@x) # => 1 |
This file contains 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
# Esta definición: | |
class Example | |
attr_accessor :x | |
end | |
## Es equivalente a: | |
class Example | |
def x | |
@x | |
end |
NewerOlder