How to create a JSON Web Token (JWT) in Javascript?
A Pen by Jonathan Petitcolas on CodePen.
Problemas de CORS | |
Fonte: https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Controle_Acesso_CORS#Requisi%C3%A7%C3%B5es_simples (TL;DR;) | |
o Navegador de internet bloqueia requisições que não sejam consideradas simples e seguras, “CORS-safelisted request-header”, ou seja a sua requisição é barrada no proprio navegador e o webserver ( nginx, apache, lighthttpd, etc... ) nem chega a passar (passthrough) a requisição para o PHP ou outro CGI. | |
ok! mas como eu corrijo ou mitigo esse comportamento??? | |
-> https://gist.github.com/FerraBraiZ/22335146a814b6309fab0a8d6cf9683c | |
e Afinal o que são requisições simples? |
<?php | |
/* | |
In the light of the latest httpoxy (https://httpoxy.org/) vulnerabilities, | |
there is really a need for a full example, how to use HTTP_X_FORWARDED_FOR properly. | |
So here is an example written in PHP, how to detect a client IP address, if you know | |
that client may be behind a proxy and you know this proxy can be trusted. | |
If you don't known any trusted proxies, just use REMOTE_ADDR | |
*/ |
<script> | |
/* Originally taken from: https://www.tikalk.com/posts/2017/11/23/your-filename/ */ | |
(function(){ | |
let iframe, domain, doc, where,url; | |
try { | |
url = '//locahost:8080/public/friendly-iframe.js'; | |
iframe = document.createElement('iframe'); | |
iframe.src = 'javascript:false'; | |
iframe.title = ''; | |
iframe.role='presentation'; |
<script> | |
let _iframe = document.createElement("iframe"); | |
_iframe.setAttribute("src", `https://google.com`); | |
_iframe.style.width = "100%"; | |
_iframe.style.height = "50vh"; | |
_iframe.style.border = "0px"; | |
_iframe.onloadend = function () { | |
console.info("https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/loadend_event"); | |
}; | |
_iframe.onload = function () { |
#!/bin/bash | |
# EN - GIT AAPT stands for update the whole danm thing | |
# PT-BR - GIT AAPT significa Atualiza a porra toda | |
# | |
REPOSITORIES="$( cd /home/${USER}/public_html/ && pwd )" | |
IFS=$'\n' | |
for REPO in `ls "$REPOSITORIES/"` | |
do |
#!/bin/bash | |
## extracted from https://askubuntu.com/questions/976145/shell-script-to-clone-every-repo-of-a-github-organization | |
## original author is in the post, all credits goes to him/her/it | |
for i in $(curl "https://api.github.com/orgs/[organization]/repos?access_token=[access_token]" | sed '/[ ]*"clone_url":/!d;s/[^:]*: "//;s/",$//'); do | |
echo git clone $i | |
done |
/* Polyfill indexOf. */ | |
var indexOf; | |
if (typeof Array.prototype.indexOf === 'function') { | |
indexOf = function (haystack, needle) { | |
return haystack.indexOf(needle); | |
}; | |
} else { | |
indexOf = function (haystack, needle) { | |
var i = 0, length = haystack.length, idx = -1, found = false; |
How to create a JSON Web Token (JWT) in Javascript?
A Pen by Jonathan Petitcolas on CodePen.
try{ | |
Dropzone.autoDiscover = false; | |
const fileTypesWhiteList = "jpeg|jpg|gif|png|bmp|pdf|doc|docx|txt|odt"; | |
let dropZoneFileUploader = new Dropzone("#dz-custom-file-upload-form",{ | |
autoDiscover: false, | |
autoProcessQueue:false, | |
uploadMultiple: true, |
<?php | |
$curl = curl_init(); | |
$url = 'http://localhost:6969/ws/'; | |
$opts = [ | |
CURLOPT_URL => $url, | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 30, | |
CURLOPT_CUSTOMREQUEST => "POST", |