Skip to content

Commit

Permalink
OK
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Feb 12, 2019
0 parents commit 4fc667e
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
.precomp/
24 changes: 24 additions & 0 deletions Origami/ConvertManifest/bower.json
@@ -0,0 +1,24 @@
{
"name": "o-table",
"dependencies": {
"o-colors": "^4.0.0",
"o-grid": "^4.0.6",
"o-icons": ">=4.0.0 <6",
"o-typography": "^5.0.0",
"o-brand": "^3.1.1",
"o-visual-effects": "^2.0.3",
"o-buttons": "^5.14.0",
"dom-delegate": "ftdomdelegate#^2.2.0"
},
"main": [
"main.scss",
"main.js"
],
"ignore": [
".gitignore",
"build",
"test",
"karma.conf.js",
"package.json"
]
}
53 changes: 53 additions & 0 deletions Origami/ConvertManifest/components.json
@@ -0,0 +1,53 @@
[
"fticons",
"o-assets",
"o-autoinit",
"o-banner",
"o-brand",
"o-buttons",
"o-colors",
"o-cookie-message",
"o-date",
"o-dom",
"o-element-visibility",
"o-errors",
"o-expander",
"o-fetch-jsonp",
"o-fonts",
"o-footer",
"o-footer-services",
"o-forms",
"o-ft-affiliate-ribbon",
"o-grid",
"o-header",
"o-header-services",
"o-hierarchical-nav",
"o-hoverable",
"o-icons",
"o-labels",
"o-layers",
"o-layout",
"o-link-list",
"o-loading",
"o-message",
"o-normalise",
"o-overlay",
"o-quote",
"o-share",
"o-squishy-list",
"o-subs-card",
"o-syntax-highlight",
"o-table",
"o-tabs",
"o-teaser",
"o-teaser-collection",
"o-techdocs",
"o-toggle",
"o-tooltip",
"o-topper",
"o-typography",
"o-utils",
"o-video",
"o-viewport",
"o-visual-effects"
]
49 changes: 49 additions & 0 deletions Origami/ConvertManifest/convert-manifest.p6
@@ -0,0 +1,49 @@
#!/usr/bin/env perl6
use JSON::Pretty;
my $components = from-json(slurp "components.json");
my $mappings = from-json(slurp "components.json");

sub add-npm-org (Str $name) {
return qq@financial-times/{$name};
}

sub create-npm-dependency (Str $name, Str $version) {
my $is-origami-component = $components.contains($name);

if ($is-origami-component) {
return add-npm-org($name), $version;
}

my $name-is-mapped = $mappings<name>.keys.contains($name);
if ($name-is-mapped) {
return $mappings<name><<$name>>, $version;
}

my $version-is-mapped = $mappings<version>.keys.contains($version);
if ($version-is-mapped) {
return $name, $mappings<version><<$version>>;
}

my $hash-version-match = $version ~~ /'#'(\^?\d+\.\d+\.\d+)/;
if ($hash-version-match.so) {
return $name, @$hash-version-match[0].Str;
}

return $name, $version;
}

sub MAIN (Str $version where * ~~ /^\d+\.\d+\.\d+$/) {
my $bowerManifest = from-json(lines);
my $packageManifest = {};
$packageManifest<version> = $version;

$packageManifest<name> = add-npm-org($bowerManifest<name>);
$packageManifest<description> = $bowerManifest<description>;
$packageManifest<homepage> = $bowerManifest<homepage>;
$packageManifest<license> = $bowerManifest<license>;
$packageManifest<dependencies> = $bowerManifest<dependencies>.map({
my ($name, $version) = create-npm-dependency(.key, .value);
Pair.new: $name, $version;
}).Hash;
put to-json($packageManifest);
}
10 changes: 10 additions & 0 deletions Origami/ConvertManifest/mappings.json
@@ -0,0 +1,10 @@
{
"name": {
"ftdomdelegate": "dom-delegate",
"prism": "prismjs",
"hogan": "hogan.js"
},
"version": {
"Financial-Times/highlight.js-shim": "^8.4.0"
}
}
5 changes: 5 additions & 0 deletions Semver/Tiny.pm6
@@ -0,0 +1,5 @@
grammar Semver is export {
token TOP {[
<caret> | <greater-than> | <less-than> | <goe-than> | <loe-than> | <version-core>
]}
}
13 changes: 13 additions & 0 deletions Text/EasyCSV.pm6
@@ -0,0 +1,13 @@
unit class Text::EasyCSV;
use Text::CSV;
my $csv = Text::CSV.new;

sub load-csv ($path) is export {
my $io = open(
$path,
:r,
chomp => False
);
my @data = $csv.getline_all($io);
return @data;
}
28 changes: 28 additions & 0 deletions black-perl.p6
@@ -0,0 +1,28 @@
BEFOREHAND: close door, each window and exit; wait until time;
open spell book; study; read (spell, scan, select); tell us;
write it, print the hex while each watches,
reverse length, write again;
kill spiders,
pop them,
chop them,
split them,
kill them;
unlink arms, shift, wait and listen (listening, wait);
sort the flock (then, warn "the goats", kill "the sheep");
kill them, dump qualms, shift moralities,
values aside, each one
die sheep; die (to, reverse the => system
you accept (reject, respect));
next step,
kill next sacrifice, each sacrifice,
wait, redo ritual until "all the spirits are pleased";
do it ("as they say");
do it($*everyone*must*participate*in*forbidden*s*e*x*);
return last victim; unit package body;
exit crypt (time, times and "half a time") & close it.
select(quickly) and warn next victim;
AFTERWARDS: tell nobody.
wait, wait until time;
wait until next year, next decade;
sleep, sleep, die yourself,
die at last
49 changes: 49 additions & 0 deletions convert-manifest.p6
@@ -0,0 +1,49 @@
#!/usr/bin/env perl6
use JSON::Tiny;
my $components = from-json(slurp "components.json");
my $mappings = from-json(slurp "components.json");

sub add-npm-org (Str $name) {
return qq@financial-times/{$name};
}

sub create-npm-dependency (Str $name, Str $version) {
my $is-origami-component = $components.contains($name);

my $name-is-mapped = $mappings<name>.keys.contains($name);
my $version-is-mapped = $mappings<version>.keys.contains($version);

if ($is-origami-component) {
return $name, $version;
}

if ($name-is-mapped) {
return $mappings<name><<$name>>, $version;
}

if ($version-is-mapped) {
return $name, $mappings<version><<$version>>;
}

return $name, $version;
}

sub MAIN (Str $version where * ~~ /^\d+\.\d+\.\d+$/) {
my $bowerManifest = from-json(lines);
my $packageManifest = {};
$packageManifest<version> = $version;
my (
$name,
$description,
$homepage,
$license,
$dependencies
) = $bowerManifest;

$packageManifest<name> = add-npm-org($name);
$packageManifest<description> = $description;
$packageManifest<homepage> = $homepage;
$packageManifest<dependencies> = $dependencies.hyper.map(&create-npm-dependency);

put to-json($packageManifest);
}
1 change: 1 addition & 0 deletions easycsv.p6
@@ -0,0 +1 @@
use Text::CSV
3 changes: 3 additions & 0 deletions nothing.p6
@@ -0,0 +1,3 @@
sub nothing is export {
say "nothing"
}

0 comments on commit 4fc667e

Please sign in to comment.