Skip to content

Instantly share code, notes, and snippets.

@bravo-kernel
bravo-kernel / appveyor.yml
Created September 6, 2017 13:02
Powershell Continuous Integration - Code Coverage
# Coveralls
Write-Host "Generating Coveralls code coverage report..."
$files = Get-ChildItem * -Include *.ps1,*.psm1
$token = 'ObxiFdeVVwlsneHqQqf5sAjdWIWiCi32X'
$coverage = Format-Coverage -PesterResults $res -CoverallsApiToken $token
Publish-Coverage -Coverage $coverage
@bravo-kernel
bravo-kernel / appveyor.yml
Created September 6, 2017 13:00
Powershell Continuous Integration - Pester
# Pester
Write-Host "Running Pester unit tests..."
$testResultsFile = ".\TestsResults.xml"
$res = Invoke-Pester -Path ".\Tests" -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru -CodeCoverage *.psm1
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestsResults.xml))
If ($res.FailedCount -gt 0) {
Throw "Build failed due to $($res.FailedCount) failing tests"
}
@bravo-kernel
bravo-kernel / appveyor.yml
Created September 6, 2017 12:16
Powershell Continuous Integration - PSScriptAnalyser
# PSscriptAnalyzer
Write-Host 'Running PSScriptAnalyser coding standards analysis...'
Add-AppveyorTest -Name "PsScriptAnalyzer" -Outcome Running
$res = Invoke-ScriptAnalyzer -Path $pwd -Recurse -ErrorAction SilentlyContinue
If ($res) {
$resultString = $res | Out-String
Write-Warning $resultString
@bravo-kernel
bravo-kernel / TypeConstraints.ps1
Created August 20, 2017 09:57
Powershell Type Constraints
# type constraints
[string]$myString = "Some String"
[array]=@(
"item1"
"item2"
)
[hashtable]$myHashTable = @{
"key" = "value"
"sub-array" = @(
"item1"
@bravo-kernel
bravo-kernel / TypeConstraints.ps1
Last active August 20, 2017 09:18
Powershell type constraints
# type constraints
[string]$myString = "Some String"
[array]=@(
"item1"
"item2"
)
[hashtable]$myHashTable = @{
"key" = "value"
"sub-array" = @(
"item1"
/etc/nginx/sites-available/cake3.app
#
# Cakebox-generated Nginx PHP-FMP virtual host using generic template.
#
server {
listen 80;
server_name www.cake3.app;
rewrite ^(.*) http://cake3.app$1 permanent;
}
package pg;
public class MyUtils {
public void testMe() {
System.out.println("most simple class");
}
}
<pre class="pr">Cake\Http\Response Object
(
[status] => 200
[contentType] => text/html
[headers] => Array
(
[Content-Type] => Array
(
[0] => text/html; charset=UTF-8
)
@bravo-kernel
bravo-kernel / debug.php
Last active April 14, 2017 17:20
JsonApi debug of response
<pre class="pr">after</pre>
<pre class="pr">App\Controller\ErrorController Object
(
[name] => Cocktails
[helpers] => Array
(
)
[request] => Cake\Http\ServerRequest Object
(
@bravo-kernel
bravo-kernel / table.php
Created April 10, 2017 13:25
Table.php
public function validationDefault(Validator $validator)
{
// make sure `approved` is a boolean
$validator
->add('approved', 'BOOLEAN', [
'rule' => 'boolean',
'message' => 'Approved must be a boolean.'
]);
return $validator;