Skip to content

Instantly share code, notes, and snippets.

View LautaroJayat's full-sized avatar
💭
👽

Lautaro Jayat LautaroJayat

💭
👽
View GitHub Profile
package strategy
import (
"io"
"net/http"
"net/http/httputil"
"os"
"github.com/julienschmidt/httprouter"
)
package strategy
import (
"net/http"
"net/http/httputil"
"github.com/julienschmidt/httprouter"
)
func FwdOptionsReq(rp *httputil.ReverseProxy) httprouter.Handle{
package Router
import (
"fmt"
"net/http/httputil"
"github.com/julienschmidt/httprouter"
s "github.com/lautarojayat/auth_proxy/proxy/strategy"
)
package director
import (
"net/http"
"os"
)
func NewDirector() func(req *http.Request){
host:= os.Getenv("HOST")
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"os"
d "github.com/lautarojayat/auth_proxy/proxy/director"
@LautaroJayat
LautaroJayat / target_server.go
Created May 10, 2021 12:49
target server go
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func welcome(w http.ResponseWriter, r *http.Request) {
@LautaroJayat
LautaroJayat / controllers.js
Created January 30, 2020 19:09
ctrl.forVideo(req,res);
ctrl.forVideo = function (req, res) {
// First we store our file name in a variable using a inmediatly-invoked function
let file = (function () {
// Split the URL in each slash "/";
let splitted = req.url.split('/');
// Then we return only the last part of that array.
return splitted[splitted.length - 1];
})();
const ctrl = require('./controllers/controllers');
const app = (req, res) => {
const URL = req.url;
// What we say when the request method isnt GET
if (req.method !== 'GET') {
ctrl.forInvalidMethod(req, res);
}
let array = [1, 2, 3, '4', undefined, 'a', [], null];
function onlyNumbers(arr) {
let output = [];
// Now we try to parseInt() each element,
// and push a new Number() created with e as an argument.
arr.forEach(e => { if (parseInt(e)) { output.push(Number(e)) } })
return output
}
console.log(onlyNumbers(array));
@LautaroJayat
LautaroJayat / onlynumbers.js
Created January 27, 2020 18:49
Array Question
let array = [1, 2, 3, '4', undefined, 'a', [], null];
function onlyNumbers(arr) {
let output = [];
// If 'isNaN()' doesn't return true for the given element, we pushit to the output array
arr.forEach(e => { if (!isNaN((e))) { output.push((e)) } })
return output
}
console.log(onlyNumbers(array));