Skip to content

Instantly share code, notes, and snippets.

View fxcosta's full-sized avatar
:octocat:
Focusing

Felix Costa fxcosta

:octocat:
Focusing
View GitHub Profile
@fxcosta
fxcosta / .gitlab-ci.yml
Created October 31, 2017 12:48
Gitlab CI + PHPloy for incremental deploy using FTP
stages:
- deploy
deploy_to_production:
image: php:5.6-cli
stage: deploy
only:
- master
environment: production
before_script:
@fxcosta
fxcosta / FacebookUser.php
Last active July 7, 2017 17:58
FacebookUser.php
<?php
namespace App\Entities;
use Laravel\Socialite\AbstractUser;
class FacebookUser extends AbstractUser {}
<?php
class Example
{
public $subject;
public function __construct()
{
$this->subject = 1;
}
let color = "purple"; // escopo global. todo mundo tem acesso a ela
function belt () {
let color = "blue"; // redefinimos o valor de color somente dentro desse escopo
function myBelt () {
let color = "brown"; // redefinimos mais uma vez o valor de color para ser usado somente nesse escopo
console.log(color); // brown
}
myBelt(); // chamará a função myBelt que imprimirá brown
function showName (firstName, lastName) {
var nameIntro = "Your name is ";
//esta função interior tem acesso as variáveis da função exterior, incluindo os parâmetros
function makeFullName () {
return nameIntro + firstName + " " + lastName;
}
return makeFullName ();
}
//--------------------------------------
// --- ANONYMOUS FUNCTION VERSION --- //
function result (triple) {
return triple(3);
}
result(function (number) {
return number * 3;
});
portugueseHello = function () {
return "Olá, ";
}
englishHello = function () {
return "Hello, ";
}
francaisHello = function () {
return "Bonjour, ";
$('a').on('click', function() {
console.log('fui pressionado');
});
portugueseHello = function () {
return "Olá, ";
}
englishHello = function () {
return "Hello, ";
}
francaisHello = function () {
return "Bonjour, ";
let warrior = {
hp: 100,
strength: 20,
attack: function(target) {
target.hp -= this.strength;
}
}
let enemy = {
hp: 100,