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
// "MyPropertyName" => "my_property_name" | |
// alt 0 | |
var sb = new StringBuilder(); | |
var chars = "MyPropertyName".ToCharArray(); | |
for(var i = 0; i < chars.Length; ++i) | |
{ | |
var c = chars[i]; | |
if (Char.IsUpper(c) && i > 0) | |
sb.Append("_"); |
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
<# | |
.SYNOPSIS | |
Generate an oauth token. | |
.DESCRIPTION | |
Generate an oauth token for a specified client and environment | |
.PARAMETER ClientId | |
The oauth client id |
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
class PooledCertificate : IDisposable | |
{ | |
public X509Certificate2 Certificate { get; private set; } | |
private readonly ObjectPool<X509Certificate2> _certificatePool; | |
public PooledCertificate(ObjectPool<X509Certificate2> certificatePool) | |
{ | |
Certificate = certificatePool.GetObject(); | |
_certificatePool = certificatePool; | |
} |
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 Tree = Leaf Int | |
| Node (List Tree) | |
generateIdsForTree : Tree -> State Int Tree | |
generateIdsForTree t = | |
case t of | |
Node n -> State.traverse generateIdsForTree n |> State.andThen (\children -> State.state <| Node children ) | |
Leaf l -> State.modify (\i -> i + 1) |> State.andThen (\_ -> State.get) |> State.andThen (\i -> State.state <| Leaf i) | |
sampleTree = Node |
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
import Html exposing (text) | |
import State exposing (State) | |
type alias QC = { qs : List Q } | |
type Q = Q { id : Int, qt : QT } | |
type QT = QT1 { subqs : List Q } | |
| QT2 { options : List QO } |
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
NB. ------------------------- calculate components ------------- | |
calculateComponent=: dyad define | |
'a b' =. >y | |
<. (a | x) % b | |
) | |
calculateComponents=: monad define | |
duration =. y |
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
// https://edabit.com/challenge/uhsik73PY7Y2XftzG | |
var alphabet = "abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz".ToUpper(); | |
var vovels = "aeiouy" + "aeiouy".ToUpper(); | |
var consonants = Regex.Replace(alphabet, $"[{vovels}]", ""); | |
var type1word = $"(?<![{vovels}])(?<t1p1>[{consonants}]+)(?<t1p2>\\w+)"; | |
var type2word = $"(?<![{consonants}]+)(?<t2>[{vovels}]\\w*)"; | |
string CaptitalizeConditional(string word, bool doit) |
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
// https://edabit.com/challenge/H4of8EdxS98ikEaZd | |
function padNumber(number, size) { | |
var s = String(number); | |
while (s.length < (size || 2)) {s = "0" + s;} | |
return s; | |
} | |
function addTimeVectors(timeStamp, timeIncrement) { | |
let weights = [1000, 60, 60, 60]; |
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
// https://edabit.com/challenge/qQu4kxTEHapogmCgE | |
let roads = { | |
"graph": { | |
"directed": false, | |
"nodes": [ | |
{ "id": 0 }, | |
{ "id": 1 }, | |
{ "id": 2 }, | |
{ "id": 3 }, |