Skip to content

Instantly share code, notes, and snippets.

View kllaudyo's full-sized avatar

Claudio Acioli kllaudyo

View GitHub Profile
@kllaudyo
kllaudyo / teste.asp
Created March 9, 2020 20:01
Split vbcrlf
<!--#include file="../util/adovbs.inc"-->
<!--#include file="../util/un_util_objetos.asp"-->
<%
sFileName = "SAP_99999.html"
Set oFileSystem = Server.CreateObject("Scripting.FileSystemObject")
Set oFile = oFileSystem.OpenTextFile(Server.MapPath(sFileName), 1, True)
sMailMsg = ""
Do Until oFile.AtEndOfStream
sMailMsg = sMailMsg & oFile.ReadLine & vbcrlf
<!--#include file="../util/adovbs.inc"-->
<!--#include file="../util/un_util_objetos.asp"-->
<%
sFileName = "SAP_99999.txt"
Set oFileSystem = Server.CreateObject("Scripting.FileSystemObject")
Set oFile = oFileSystem.OpenTextFile(Server.MapPath(sFileName), 1, True)
sMailMsg = ""
Do Until oFile.AtEndOfStream
sMailMsg = sMailMsg & oFile.ReadLine
declare
rs sys_refcursor;
type result is record(
status char(1),
message varchar2(250)
);
x result;
begin
procedure_returns_sys_ref_cursor(rs_out_parameter, others_parameters);
if rs_out_parameter is not null then
@kllaudyo
kllaudyo / pagination.sql
Last active January 23, 2019 16:20
Paginação Oracle
select x.*
from (
--aqui dentro vai o seu sql normalmente, com where e etc..
select /*+ FIRST_ROWS(25)*/ --aqui indice de velocidade do próprio oracle
nu_expediente,
row_number() over (order by dt_documento desc, co_seq_documento) rn --ordene pelo que deseja e também por algo único
from tb_documento
) x
where x.rn between 1 and 25 --aqui tu pagina, a pagina dois é 26 and 50
order by x.rn;
@kllaudyo
kllaudyo / sample_cursor_in.pls
Created December 3, 2018 17:38
Iterando cursor com "FOR IN"
CREATE OR REPLACE PROCEDURE SAMPLE_CURSOR_IN AS
CURSOR UFS IS
SELECT ID_UF, NM_UF
FROM UNIDADES_FEDERACAO;
BEGIN
FOR J IN UFS
LOOP
CONTENT := '{"sigla":"'|| J.ID_UF ||'","nome":"'|| J.NM_UF ||'"}';
END LOOP;
DBMS_OUTPUT.PUT_LINE(CONTENT);
const
byId = id =>
document.getElementById(id)
,
byName = (name, parent=document) =>
parent.getElementsByName(name)
,
byTag = (tag, parent=document) =>
parent.getElementsByTagName(tag)
,
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';
import reducer from "../reducers";
const store = createStore(
reducer,
(localStorage['store']) ?
JSON.parse(localStorage['store']) :
{},
<!--#include file="adovbs.inc"-->
<%
Dim iParameter1 = 0
Dim iParameter2 = 0
Set oConn = Server.CreateObject("adodb.connection")
oConn.ConnectionString = "Provider=MSDAORA.1;Password=password;User ID=user;Data Source=service_name;Persist Security Info=True;PLSQLRSet=1"
oConn.Open
@kllaudyo
kllaudyo / hasConnection.js
Last active August 20, 2018 13:50
Verify internet connection
const HTTP_STATUS_OK = 200,
HTTP_STATUS_NOT_MODIFIED = 304,
HTTP_STATUS_MULTIPLE_CHOICE = 300,
HTTP_METHOD = "HEAD",
hasConnection = (host = window.location.protocol + "//" + window.location.hostname) => {
if(window.navigator)
return navigator.onLine;
else{
const xhr = new (window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP");
xhr.open(HTTP_METHOD, host, false);
@kllaudyo
kllaudyo / preload.js
Last active August 9, 2018 21:14
Simple preload images
const preload = () => {
const images = [];
for(let i=arguments.length;i--;){
const index = images.length;
images[index] = new Image();
images[index].src=arguments[i];
}
return images;
};