Skip to content

Instantly share code, notes, and snippets.

View DawTaylor's full-sized avatar
👀

Adalberto Taylor DawTaylor

👀
  • Águas de Lindóia - SP - Brazil
  • 06:11 (UTC -03:00)
View GitHub Profile
@DawTaylor
DawTaylor / gulpfile.js
Created May 19, 2017 19:23
Criando um gulpfile do ZERO!!!
// Dependências da build
const gulp = require('gulp')
const pug = require('gulp-pug')
const sass = require('gulp-sass')
const cssMin = require('gulp-csso')
const browserSync = require('browser-sync').create()
const clean = require('gulp-clean')
// Compila os arquivos do PUG para HTML
gulp.task('html', () => {
<script>
import Vue from 'vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
const qs = require('qs')
Vue.use(VueAxios, axios)
export default {
name: 'home',
<input type="password" id="pwd">
<input type="checkbox" v-model="showPwd">
#!/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
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()
@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
@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 / 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 / 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 / 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 />";
}