Skip to content

Instantly share code, notes, and snippets.

@librasteve
librasteve / fosscarveout.txt
Created October 27, 2024 17:11
FOSS Carve Out from EU Directive
(14) Free and open-source software, whereby the source code is openly shared and users can freely access, use, modify and redistribute the software or modified versions thereof, can contribute to research and innovation on the market. Such software is subject to licences that allow anyone the freedom to run, copy, distribute, study, change and improve the software. In order not to hamper innovation or research, this Directive should not apply to free and open-source software developed or supplied outside the course of a commercial activity, since products so developed or supplied are by definition not placed on the market. Developing or contributing to such software should not be understood as making it available on the market. Providing such software on open repositories should not be considered as making it available on the market, unless that occurs in the course of a commercial activity. In principle, the supply of free and open-source software by non-profit organisations should not be considered as takin
@librasteve
librasteve / page.html
Created October 3, 2024 01:25
HTML Page
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
.jumbotron {
background-color: #e6ffe6;
text-align: center;
@librasteve
librasteve / page.elm
Created October 3, 2024 01:24
Page Elm
module HomePage exposing (main)
import Html exposing (..)
import Html.Attributes exposing (..)
view model =
div [ class "jumbotron" ]
[ h1 [] [ text "Welcome to Dunder Mifflin!" ]
, p []
@librasteve
librasteve / index.php
Created September 15, 2024 18:14
Simple PHP HTML Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple PHP Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
@librasteve
librasteve / cpe.txt
Created September 14, 2024 18:06
comma plugin errs
Project source sets cannot be resolved
org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:248)
at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:239)
at org.gradle.api.internal.provider.AbstractProperty.calculatePresence(AbstractProperty.java:65)
at org.gradle.api.internal.provider.AbstractMinimalProvider.isPresent(AbstractMinimalProvider.java:90)
at com.intellij.gradle.toolingExtension.impl.model.sourceSetModel.GradleSourceSetModelBuilder.getJavaToolchainHome(GradleSourceSetModelBuilder.java:513)
at com.intellij.gradle.toolingExtension.impl.model.sourceSetModel.GradleSourceSetModelBuilder.addJavaCompilerOptions(GradleSourceSetModelBuilder.java:495)
at com.intellij.gradle.toolingExtension.impl.model.sourceSetModel.GradleSourceSetModelBuilder.lambda$collectSourceSets$1(GradleSourceS
@librasteve
librasteve / hfstyle.raku
Created August 27, 2024 14:29
HTML::Functional Style
#| convert camel case fieldnames like 'firstName' to labels like 'First Name: '
sub camel2label(Str $camel) {
$camel.subst( /(<lower>)(.*)(<upper>)?(.*)?/, {$0.uc~$1~($2//'')~($3//'')~': '} );
}
#| convert name to crotmp variable form eg. 'firstName' => '<.firstName>'
sub crotmpvar(Str $name) {
$name.subst( /(.*)/, {"<.$0>"} );
}
@librasteve
librasteve / iterator.raku
Last active July 5, 2024 15:14
Raku oddNumbers Iterator (following Nim example)
#`[Nim example:
# Thanks to Nim's 'iterator' and 'yield' constructs,
# iterators are as easy to write as ordinary
# functions. They are compiled to inline loops.
iterator oddNumbers[Idx, T](a: array[Idx, T]): T =
for x in a:
if x mod 2 == 1:
yield x
@librasteve
librasteve / ramd.raku
Created June 22, 2024 17:22
Raku Markdown
#!/usr/bin/env raku
use MONKEY-SEE-NO-EVAL;
#| takes markdown file and evals all code lines delimited by '```perl6 xxx ```'
sub MAIN(
$filename!, #= '/pathto/example.md'
) {
my @lines = $filename.IO.lines or die 'no file found';
my $toggle = False;
@librasteve
librasteve / functional.raku
Created May 18, 2024 16:51
How Functional Is Raku?
#viz. https://rosettacode.org/wiki/100_doors
#`[ Elm for comparison
import List exposing (indexedMap, foldl, repeat, range)
import Html exposing (text)
import Debug exposing (toString)
type Door = Open | Closed
toggle d = if d == Open then Closed else Open
@librasteve
librasteve / test.raku
Created February 22, 2024 05:04
How to use sub capture and gather together
sub dims-match( @a ) {
given @a {
when *== 0 { '' }
when *== 1 { .first }
when *>= 2 { .&type-hint }
}
}
gather {
for $.dictionary.type-to-dims.kv -> $key, $value {