Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Lira lira92

View GitHub Profile
View AbstractSeedFromJson.php
<?php
namespace App\Migrations;
use Phinx\Seed\AbstractSeed;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\FileNotFoundException;
class AbstractSeedFromJson extends AbstractSeed
{
@lira92
lira92 / generate-code-coverage.ps1
Created Feb 6, 2019
Generate code coverage with coverlet and reportgenerator when there are many assemblies
View generate-code-coverage.ps1
param (
[string]$format = "opencover",
[bool]$nohtml = $false
)
if (-Not (Get-Command -Name reportgenerator -ErrorAction SilentlyContinue))
{
Write-Output "Installing reportgenerator"
Invoke-Expression "dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.0.9"
}
@lira92
lira92 / .deployment
Created Dec 4, 2018
Angular Deployment to Azure using Kudu
View .deployment
[config]
command = deploy.cmd
@lira92
lira92 / generate-code-coverage.ps1
Last active Nov 14, 2018
Powershell to get all projects from path /test and run tests with coverage info.
View generate-code-coverage.ps1
if (-Not (Get-Command -Name reportgenerator -ErrorAction SilentlyContinue))
{
Write-Output "Instalando reportgenerator"
Invoke-Expression "dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.0.0"
}
Write-Output "Listando arquivos csproj"
$reports = [System.Collections.ArrayList]@()
Get-ChildItem -Path .\test -Recurse -Filter *.csproj -File | ForEach-Object {
Write-Output "Executando testes para o projeto $($_.BaseName)/$($_.Name)"
@lira92
lira92 / tasks.json
Created Aug 1, 2018
Tasks Visual studio code
View tasks.json
{
"label": "Test",
"type": "shell",
"command": "dotnet test [caminho do projeto de testes] /p:CollectCoverage=true /p:CoverletOutputFormat=opencover",
"group": "test",
"presentation": {
"reveal": "silent",
"panel": "shared"
}
},
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Check for missing plugins
required_plugins = %w(vagrant-winnfsd)
plugin_installed = false
required_plugins.each do |plugin|
unless Vagrant.has_plugin?(plugin)
system "vagrant plugin install #{plugin}"
plugin_installed = true
View display.ctp
<?php if($nextEvent != null): ?>
<div class="black-panel">
<h3><?= $nextEvent->name; ?></h3>
<span><?= $nextEvent->date->i18nFormat('d MMMM y'); ?></span>
<div class="countdown">
<div class="countdown-timer">
<span class="info-text"><span class="text-icon">&#59249;</span><?= __("Countdown Till Start"); ?></span>
<h4 class="countdown-text" rel="<?= strtotime($nextEvent->date->format('Y-m-d H:i')); ?>"></h4>
</div>
<p><?= $nextEvent->description; ?></p>
View NextEventCell.php
<?php
namespace App\View\Cell;
use Cake\View\Cell;
class NextEventCell extends Cell
{
public function display()
{
$this->loadModel("Events");
$nextEvent = $this->Events->find()->where(['date >=' => date("Y-m-d")])->first();
$this->set(compact('nextEvent'));
@lira92
lira92 / BancosController.cs
Created Dec 6, 2016
dependency injection
View BancosController.cs
private readonly IBancoRepository _bancoRepository;
public BancosController()
{
var repository = Global.container.GetInstance<IBancoRepository>();
_bancoRepository = repository;
}
View BancosController.cs
[RemotingService]
public class BancosController
{
private IBancoRepository _bancoRepository { get; set; }
public BancosController(IBancoRepository bancoRepository)
{
_bancoRepository = bancoRepository;
}
}