This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsup() { | |
if [ $# -eq 1 ]; then | |
local file=${1} path=$(pwd) | |
elif [ $# -eq 2 ]; then | |
local file=${2} path=$(realpath -es "${1}") | |
else | |
echo >&2 "Usage: lsup [path] filename" | |
echo >&2 " At least filename is required" | |
return 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
walk( | |
if (type == "object" and has("parameters") ) then | |
.parameters |= [ | |
.[] | if ( .schema.type == "array" ) then | |
.schema.collectionFormat |= "csv" | |
else | |
. | |
end | |
] | |
) else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// File: DefaultingEnumConverter.cs | |
using System; | |
using System.Linq; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Converters; | |
using Newtonsoft.Json.Serialization; | |
public class DefaultingEnumConverter : JsonConverter | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for gitdir in $(find . -maxdepth 1 -type d -exec test -e '{}'/.git \; -print); do | |
pushd $gitdir > /dev/null 2>&1; | |
if [ -z "$(git status --short)" ] | |
then | |
git checkout develop > /dev/null 2>&1; | |
git fetch > /dev/null 2>&1; | |
git pull > /dev/null 2>&1; | |
echo \'$gitdir\' has been updated to latest.; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
browse = "! f() {\n local CurrentBranch=$(git symbolic-ref --short HEAD);\n local DefaultRemote=$(git config branch.${CurrentBranch}.pushRemote || git config branch.${CurrentBranch}.remote || git config remote.pushDefault || echo origin);\n local RemoteUrl=$(git remote get-url ${DefaultRemote} 2> /dev/null);\n if (test -n \"${RemoteUrl}\") then\n start \"${RemoteUrl}\";\n else\n echo \"No remote url found!\";\n fi\n}; f" | |
graph = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' | |
ignore = ! gi() {\n local outfile="$([ $1 != list ] && echo '-o ./.gitignore')"\n local parts="$(printf "%s," "$@")"\n parts="${parts%,}"\n curl -sL ${outfile} https://www.toptal.com/developers/gitignore/api/${parts}\n}; gi | |
latest = fetch --all --prune --tags --progress | |
[diff] | |
tool = bc | |
[difftool] | |
prompt = false | |
[difftool "bc"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Data; | |
using System.Linq; | |
public static class IEnumerableExtensions | |
{ | |
public static DataTable ToDataTable<T>(this IEnumerable<T> value) | |
{ | |
var result = new DataTable(); | |
var tType = typeof(T); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Iterates over all modules with name ending in "Test", | |
/// Gets the properties from the module and dumps the property | |
/// name and result to results window. Append to https://gist.github.com/psaxton/c6ec6841a63bf0092304787697dc3beb | |
/// for an example of use. | |
Assembly.GetExecutingAssembly().ExportedTypes | |
|> Seq.where (fun t -> t.FullName.EndsWith("+Test")) | |
|> Seq.collect (fun t -> t.GetProperties()) | |
|> Seq.map (fun p -> sprintf "%s %s: %A" (p.DeclaringType.FullName.Replace('+', ' ')) p.Name (p.GetValue(None))) | |
|> Seq.reduce (fun testA testB -> sprintf "%s\n%s" testA testB) | |
|> Extensions.Dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Trie<'T when 'T : comparison> = { | |
IsTerminal: bool; | |
Children: Map<'T, Trie<'T>>; | |
} | |
module Trie = | |
module Map = | |
let addOrReplace key value map = | |
map | |
|> Map.remove key |