Assuming you have Visual studio code installed and on the path. Assuming you have git installed and on the path.
- Open PowerShell.
- Edit your profile
code $profile
try { $null = gcm pshazz -ea stop; pshazz init } catch { } | |
function PromptAdmin { | |
$identity = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()) | |
$isAdmin = $identity.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) | |
if ($isAdmin) { | |
Write-Host "ADMIN " -NoNewline -ForegroundColor Red | |
} | |
} |
defmodule Result do | |
@type t :: {:ok, any} | {:failure, any} | |
@spec map(Result.t, any :: any) :: Result.t | |
def map(result, mapping) do | |
case result do | |
{:ok, value} -> {:ok, mapping.(value)} | |
{:this_is_wrong, err} -> {:this_is_wrong, err} | |
end | |
end |
class Async<Wrapped> { | |
func map(function: @escaping (Wrapped) -> NewWrapped) -> Async<NewWrapped> { | |
// ... | |
} | |
// ... | |
} | |
typealias AsyncResult<Success, Failure> = Async<Result<Success, Failure>> |
package com.example.application | |
import com.example.dateextensions.Date | |
fun main() { | |
println(Date.tomorrow()) | |
} |
import java.util.function.Function; | |
interface Result<T, E> { | |
static <T, E> Success<T, E> success(T value) { | |
return new Success<>(value); | |
} | |
static <T, E> Error<T, E> error(E value) { | |
return new Error<>(value); | |
} |
#!/bin/bash | |
set -e | |
set -v | |
dotnet publish -c release -r linux-x64 | |
warp-packer --arch linux-x64 --input_dir cli-app/bin/Release/netcoreapp2.2/linux-x64/publish --exec cli-app --output cli-app/bin/Release/netcoreapp2.2/cli-app-linux | |
dotnet publish -c release -r osx-x64 | |
warp-packer --arch macos-x64 --input_dir cli-app/bin/Release/netcoreapp2.2/osx-x64/publish --exec cli-app --output cli-app/bin/Release/netcoreapp2.2/cli-app-osx |
[<AutoOpen>] | |
module Prelude | |
type AsyncResult<'T, 'TError> = | |
Async<Result<'T, 'TError>> | |
module AsyncResult = | |
let map (mapping : 'T -> 'U) (result : AsyncResult<'T, 'TError>) : AsyncResult<'U, 'TError> = | |
async { | |
match! result with |
sealed class Result<A, E> { | |
fun <B> map(mapping: (A) -> B): Result<B, E> = | |
when (this) { | |
is Success -> Success(mapping(value)) | |
is Failure -> Failure(reason) | |
} | |
fun <B> bind(mapping: (A) -> Result<B, E>): Result<B, E> = | |
when (this) { | |
is Success -> mapping(value) |
task dependenciesGraphDot { | |
mustRunAfter "clean" | |
def graphBuildDir = "build/dependenciesGraph" | |
def dotFile = file "$graphBuildDir/graph.dot" | |
doLast { | |
delete graphBuildDir | |
mkdir graphBuildDir |