Skip to content

Instantly share code, notes, and snippets.

View willianmano's full-sized avatar
🎯
Focusing

Willian Mano willianmano

🎯
Focusing
View GitHub Profile
<?php
namespace Logger;
abstract class LoggerAbstract implements LoggerInterface {
protected $prefix = "";
protected function getStrToLog($str) {
return $this->prefix . " - " . $str;
}
<?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
public function postCreate(Request $request)
{
$this->validate($request, $this->contratoRepository->createRules());
try {
DB::beginTransaction();
$contratoData = $request->all();
$contratoData['str_resenha'] = $this->gerarTextoResenha($contratoData);
@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)
{
<?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);
{{!
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
@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 / moodle
Created April 19, 2018 10:58
Moodle cron
* * * * * www-data /usr/local/bin/run_moodle_cron_tasks
@willianmano
willianmano / events.php
Created May 21, 2018 12:16
Moodle redirects after login
<?php
// File located in the DB folder
$observers = array(
array(
'eventname' => '\core\event\user_loggedin',
'callback' => 'yourplugin_dashboard_redirect',
'includefile' => 'yourplugin/localib.php'
)