Skip to content

Instantly share code, notes, and snippets.

View willianmano's full-sized avatar
🎯
Focusing

Willian Mano willianmano

🎯
Focusing
View GitHub Profile
@willianmano
willianmano / mydashboard.php
Created March 23, 2018 19:54
Moove without moodledata calculation
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@willianmano
willianmano / lib.php
Created July 19, 2017 15:27
Ranking without users link on profile picture
<?php
// This file is part of Ranking block for Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
<?php
use Silex\Application;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
define("APP_ROOT", dirname(__DIR__));
chdir(APP_ROOT);
@willianmano
willianmano / CustomValidator
Created October 13, 2016 19:15
Laravel CPF and CPNJ validator
<?php
namespace Convid\Validation;
use Illuminate\Validation\Validator;
class CustomValidator extends Validator
{
public function validateCpf($attribute, $value, $parameters)
{
public function postCreate(Request $request)
{
$this->validate($request, $this->contratoRepository->createRules());
try {
DB::beginTransaction();
$contratoData = $request->all();
$contratoData['str_resenha'] = $this->gerarTextoResenha($contratoData);
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
<?php
namespace Logger;
abstract class LoggerAbstract implements LoggerInterface {
protected $prefix = "";
protected function getStrToLog($str) {
return $this->prefix . " - " . $str;
}
$app->before(function(Request $request, Application $app) {
$pathInfo = $request->getPathInfo();
$openRoutes = [
'/v1/auth/login',
];
if(in_array($pathInfo, $openRoutes)) {
return true;
}
@willianmano
willianmano / gist:9cfdff68624472cdde70
Created May 18, 2015 13:55
App\Http\Controllers\Auth\AuthController.php
<?php namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Illuminate\Http\Request;
class AuthController extends Controller {