Skip to content

Instantly share code, notes, and snippets.

View DawTaylor's full-sized avatar
👀

Adalberto Taylor DawTaylor

👀
  • Águas de Lindóia - SP - Brazil
  • 11:46 (UTC -03:00)
View GitHub Profile
'use strict'
let f = process.argv[1]
console.log('Double negation usage sample. (!!)')
console.log('!var => ', !f)
console.log('!!var => ', !!f)
@DawTaylor
DawTaylor / get_sample.php
Last active October 10, 2016 14:39
PHP $_GET sample for a simple URL reversing
<?php
//Saves $_GET['url'] parameter to var
$reverseURL = $_GET['url'];
//Logs the reverse URL to page
echo "Reverse URL => " . $reverseURL . "<br />";
//Reverts the $reverseURL string and saves it to var
$regularURL = strrev($reverseURL);
@DawTaylor
DawTaylor / base64_sample.php
Last active October 10, 2016 15:13
Base 64 URL encoding/decoding sample
<?php
//Checks if plain URL was given
if ( $_GET['url'] ){
//Encodes $_GET['url'] parameter
$encodedURL = base64_encode( urlencode( $_GET['url'] ) );
//Prints out the encoded url
echo "Encoded URL => " . $encodedURL . "<br />";
}
@DawTaylor
DawTaylor / server
Last active November 11, 2016 19:02
Tentativa de configuração do NGINX
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/SITE/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name SITE.com.br www.SITE.com.br;
location ~ \.php$ {
@DawTaylor
DawTaylor / router.php
Created November 14, 2016 20:33
Acts like an .htaccess that redirects all requests to index.php (WP and CI like)
<?php
if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) {
return false;
} else {
$_GET['q'] = $_SERVER['REQUEST_URI'];
include __DIR__ . '/index.php';
}
@DawTaylor
DawTaylor / simple-ajax-post.JS
Created November 24, 2016 01:14
Simple Ajax Post Data
$.ajax({
url : 'handlerURL',
type : 'POST', //Cloud be GET/PUT/DELETE/PATCH
data : $(form).serialize(), // could be { foo : 'bar', bar : 'foo' }
success : function(data){
//Do something with success data
},
error : function(error){
//Do something with error data
}
@DawTaylor
DawTaylor / letsencrypt.sh
Created November 24, 2016 03:21
Obtains Let's Encrypt certo without stop http server
letsencrypt certonly --standalone --standalone-supported-challenges http-01 --http-01-port 8080 -d DOMAIN
var setRoute = function(file){
var module = require("./controller/" + file)
module.map(function(route, index){
routes.set(route.path, route.method, function(req, res, next){
module[index].action(req.params, function(data, code){
res.send(code, data)
return next()
#!/bin/bash
# Verifica entradas
if [ -z $1 ]; then
echo "Caminho não informado <br />"
exit 1
fi
if [ -z $2 ]; then
echo "Domínio não informado <br />"
exit 1
<input type="password" id="pwd">
<input type="checkbox" v-model="showPwd">