Skip to content

Instantly share code, notes, and snippets.

@Heavyblade
Heavyblade / googledrive.js
Created April 25, 2020 15:52
googledrive.js
function fileUpload( file, parent_id, callback ) {
var fileToUp = readFile( file ),
contentType = $.extensions[file.split(".").pop()] || "application/octet-stream";
if ( fileToUp.name !== "empty" ) {
$.ajax({
type: "POST",
url: "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable",
headers: { "Authorization": ("Bearer " + theApp.globalVarToString("vStorageDat/DRIVE_AUTH_TOKEN")),
"Content-Type": "application/json",
@Heavyblade
Heavyblade / cors_text.html
Created April 24, 2020 16:58
cors_text.html
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Docuware</title>
<!-- Bootstrap -->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' integrity='sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u' crossorigin='anonymous'>
@Heavyblade
Heavyblade / index.html
Created April 16, 2020 20:57
index.html
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Docuware</title>
<!-- Bootstrap -->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' integrity='sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u' crossorigin='anonymous'>
@Heavyblade
Heavyblade / vcloud.rb
Last active April 10, 2020 13:24
vcloud.rb
require 'rubygems'
require 'httparty'
require 'net/https'
require 'json'
module Velneo
class Vcloud
include HTTParty
base_uri "https://cloudapi.velneo.com/v1"
@Heavyblade
Heavyblade / cicle.js
Last active February 18, 2020 17:11
cicle.js
var array = [1,2,3,4,5,6];
function cicle(arr) {
return function() {
arr.push(arr.shift());
return arr[arr.length -1];
}
}
var getNext = cicle(array);
@Heavyblade
Heavyblade / iteracion.js
Created February 6, 2020 19:38
iteracion.js
const items = {
"item_1": 1,
"item_2": 2,
"item_3": 3,
"item_4": 4,
"item_5": 5,
"nombre": "cristian",
"apellido": "vasquez"
};
@Heavyblade
Heavyblade / ajax.js
Created January 7, 2020 14:57
ajax.js
importClass("XMLHttpRequest");
importClass( "VFile" );
importClass("VTextFile");
function readFile(path) {
var fi = new VFile( path ),
fileInfo;
if ( fi.open( VFile.OpenModeReadOnly ) ) {
fileInfo = {name: fi.info().fileName(), array: fi.readAll()};
def result_to_csv(name, result)
values = result.map { |x| x[:values] }
csv = [values.first.keys]
values.each { |x| csv << x.values }
csv_string = csv.map { |x| x.join(";") }.join("\n")
file = File.open(name, "w")
file.write(csv_string)
file.close
end
@Heavyblade
Heavyblade / utility
Created August 30, 2019 15:55
utilit.js
WAIT_TIMEOUT = 60000;
var casper = require('casper').create({
verbose: true,
logLevel: 'debug',
exitOnError: true,
timeout: 60000,
wait_timeout: WAIT_TIMEOUT,
viewportSize: {
width: 1920,
@Heavyblade
Heavyblade / metadata.json
Created July 20, 2019 16:12
metadata.json
[{"id":"cirrusdat/CIRRUS_CAMPOS","name":"campos","editable":true,"singleName":"campos","desc":"","project":"cirrusdat","tableType":0,"inMemory":false,"fields":[{"id":"ID","name":"Code","type":6,"bindType":0,"bindTypeName":"none","fieldBoundedTableId":"","fieldIsSigned":false,"fieldDecimals":0,"fieldMaximumValue":16777215,"fieldMinimumValue":0,"hidden":false},{"id":"NAME","name":"Name","type":1,"bindType":0,"bindTypeName":"none","fieldBoundedTableId":"","fieldIsSigned":false,"fieldDecimals":0,"fieldMaximumValue":0,"fieldMinimumValue":0,"hidden":false},{"id":"TABLAS","name":"tabla","type":6,"bindType":1,"bindTypeName":"maestra","fieldBoundedTableId":"3ppd4qwn.vcd@CIRRUS_TABLAS","fieldIsSigned":false,"fieldDecimals":0,"fieldMaximumValue":65535,"fieldMinimumValue":0,"hidden":false},{"id":"INCLUIR","name":"Incluir","type":10,"bindType":0,"bindTypeName":"none","fieldBoundedTableId":"","fieldIsSigned":false,"fieldDecimals":0,"fieldMaximumValue":0,"fieldMinimumValue":0,"hidden":false},{"id":"IDREF","name":"idRef","ty