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
| {-# LANGUAGE GHC2021 #-} | |
| {-# LANGUAGE ExplicitNamespaces #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE DuplicateRecordFields #-} | |
| {-# LANGUAGE NoFieldSelectors #-} | |
| {-# LANGUAGE NamedFieldPuns #-} | |
| {-# LANGUAGE DisambiguateRecordFields #-} | |
| {-# LANGUAGE OverloadedRecordDot #-} |
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
| from contextlib import contextmanager | |
| @contextmanager | |
| def exception_context_manager(suppress_exception: bool): | |
| print("context start") | |
| try: | |
| yield | |
| except Exception as e: | |
| print("context exception", e) | |
| if not suppress_exception: |
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
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use File::Copy qw(mv); | |
| use Data::Dumper qw(Dumper); | |
| die if @ARGV < 2; | |
| my $destination = $ARGV[@ARGV - 1]; |
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
| enum EventType { | |
| connectTwitter, | |
| addSource, | |
| } | |
| type EventPayload = { | |
| [EventType.connectTwitter]: { id: number } | |
| [EventType.addSource]: { x: string; y: 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
| ♻️ for refactoring | |
| 🔥 for removing old stuff | |
| ✅ for tests | |
| 🕴️ for rules | |
| 🔨 for build system | |
| 📝 for docs | |
| 🏗️ for infrastructure | |
| 🔧 for small tweaks/fixes | |
| ✨ for new features or polish |
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
| using NUnit.Framework; | |
| using NUnitLite; | |
| using System; | |
| using System.Reflection; | |
| using System.Linq; | |
| public static class Solution | |
| { | |
| public static int Solve() => | |
| (new[] { 1, 2, 3}).Sum(x => x * 2); |
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
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'uri' | |
| require 'yaml' | |
| Reference = Struct.new(:rule_name, :base_uri, :fragment) | |
| def parse_uri(uri_text) | |
| uri = URI.parse(uri_text) | |
| fragment = uri.fragment |
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
| def puzzle(seq: Seq[Int]): Unit = | |
| seq match { | |
| case head :: rest => | |
| println(s"$head :: $rest") | |
| case Nil => | |
| println("Nil") | |
| case _ => | |
| println("_") | |
| } |
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
| import Html exposing (beginnerProgram, div, button, text) | |
| import Html.Events exposing (onClick) | |
| -- "You will not see runtime errors in practice" except here ;) | |
| compute model value = value % model | |
| main = | |
| beginnerProgram { model = 1, view = view, update = update } | |
| view model = |
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
| import Html exposing (Html, Attribute, beginnerProgram, text, div, input) | |
| import Html.Attributes exposing (..) | |
| import Html.Events exposing (onInput) | |
| import String | |
| convert : String -> String | |
| convert input = | |
| String.toInt input | |
| |=> Result.toMaybe | |
| |+> maybeFilter (\x -> x < 10) |
NewerOlder