This file contains hidden or 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
const AsciiZero = 48; | |
const AsciiNine = 57; | |
int unsafeParseInt(String input) => | |
input.codeUnits.map((x) => x - AsciiZero).fold(0, (a, b) => (a * 10) + b); | |
int? safeParseInt(String input) => input.codeUnits | |
.map((x) => (x < AsciiZero || x > AsciiNine) ? null : (x - AsciiZero)) | |
.fold(0, (acc, value) => value == null ? null : (acc! * 10) + (value)); |
This file contains hidden or 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
package ast | |
import ( | |
"bytes" | |
"fmt" | |
"monkey/token" | |
"strings" | |
) | |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
d := time.Now() | |
end := time.Date(2024, 6, 1, 0, 0, 0, 0, d.Location()) |
This file contains hidden or 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
curl -s curl -s https://api.github.com/repos/extrawurst/gitui/releases/latest | grep -wo "https.*linux.*gz" | wget -qi - # get the latest builds of gitui (they are archives) | |
tar xzvf gitui-linux-musl.tar.gz # extract the gitui executable from the musl build archive | |
sudo chown root:root gitui # set ownership and group ownership of the gitui executable to root | |
sudo chmod u=rwx,g=rx,o=rx gitui # set the permission of the gitui executable to reflect the usual permissions in /usr/local/bin/ (-rwxr-xr-x) | |
sudo mv gitui /usr/local/bin/ # move the gitui executable to /usr/local/bin/ | |
rm gitui-linux-aarch64.tar.gz gitui-linux-arm.tar.gz gitui-linux-armv7.tar.gz gitui-linux-musl.tar.gz # remove downloaded archives |
This file contains hidden or 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
#r "nuget: FParsec, 2.0.0-beta2" | |
open System | |
open FParsec | |
open FParsec | |
open FParsec | |
type Value = | |
| Int of int | |
| Str of string |
This file contains hidden or 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
public abstract class OtherLogLevels : IEquatable<OtherLogLevels>, IStructuralEquatable, IComparable<OtherLogLevels>, IComparable, IStructuralComparable | |
{ | |
public bool IsInfo { get; } | |
public bool IsWarning { get; } | |
public bool IsError { get; } | |
public int Tag { get; } | |
public static OtherLogLevels NewError(int item); | |
public static OtherLogLevels NewInfo(string item); | |
public static OtherLogLevels NewWarning((int, string) item); |
This file contains hidden or 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 OtherLogLevels = | |
| Error of int | |
| Warning of struct(int * string) | |
| Info of string |
This file contains hidden or 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
public enum LogLevels | |
{ | |
Error = 1, | |
Warning = 2, | |
Info = 3 | |
} |
This file contains hidden or 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 LogLevels = | |
| Error = 1 | |
| Warning = 2 | |
| Info = 3 |
This file contains hidden or 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
var strLength = FunctionalParadigms.aFunction("Thing"); // Returns 5 |
NewerOlder