Skip to content

Instantly share code, notes, and snippets.

View antoniojps's full-sized avatar
🐬
Always learning

António Santos antoniojps

🐬
Always learning
View GitHub Profile
@antoniojps
antoniojps / php-files.php
Created April 3, 2017 23:19
PHP Files Functions
<?php
$path ='/dir0/dir1/myfile.php';
$file = 'file1.txt';
// Return filename
echo basename($path);
// Return filename without ext
echo basename($path, '.php');
@antoniojps
antoniojps / vue-router.js
Last active April 9, 2017 14:50
Vue Router
import Vue from "vue"
import App from "./App.vue";
import VueRouter from "vue-router";
import User from "./components/user/User.vue";
import Home from './components/Home.vue';
Vue.use(VueRouter);
const router = new VueRouter(
{
@antoniojps
antoniojps / es6.js
Last active April 9, 2017 14:50
ES6 - ECMASCRIPT 2015
/////////////////////////////////////////
// Let e const sao block scoped
{
let a = 2;
const b = "Hey";
console.log(a,b);
}
/////////////////////////////////////////
@antoniojps
antoniojps / vue-component.js
Last active April 9, 2017 14:50
Componentes do Vue
Vue.component('meu-componente',{
el: '.class',
// criamos funcao que retorna objetos para que nao interfiram com os outros componentes
data: function(){
return {
foo: 'bar'
}
},
template: '<p>{{foo}}</p>'
});
@antoniojps
antoniojps / vue-cli
Last active April 9, 2017 14:50
Comandos para começar novo projeto Vue
$ vue init webpack-simple my-project
$ cd my-project
$ npm install
$ npm run dev
/*
HTTPS no Domain
Rate limiting
PDO Prepared statements
# Hash sensitive data
# Check the ORIGIN header
Check the REFERER header
If the Origin header is not present, verify the hostname in the
Referer header matches the site's origin.
@antoniojps
antoniojps / pdo.php
Last active April 9, 2017 14:49
PHP - PDO Connect e prepared statements
/////////////////////
// Connect
try {
$host = "localhost";
$database = "learning_pdo";
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8","antonio","123");
}
@antoniojps
antoniojps / tweenmax.js
Last active April 9, 2017 14:49
GSAP Tweenmax
// BASICO
var img = $('img'),
h2 = $('h2'),
tl = new TimelineMax();
tl
//from,fromTo, ou to, (elemento, tempo, opcoes)
.from(h2,0.3,{y:-15,autoAlpha:0,ease:Power1.easeOut})
// 0.15 seconds earlier than previous
.from(img,1,{y:-15,autoAlpha:0,ease:Power1.easeOut},'-=0.15')