How do you sort a list of words on the 4th character of the word? What"s the shortest solution?
[ "strawberry", "helicopter", "wales", "acorn" ]
should be:
<?php | |
function convertfilename($filename) { | |
$filename = str_replace([ "?", "[", "]", "/", "\\", "=", "<", ">", | |
":", ";", ",", "'", '"', "&", "$", "#", | |
"*", "(", ")", "|", "~" ], "", $filename); | |
$filename = preg_replace("/[\s-]+/", "-", $filename); | |
$filename = trim($filename, ".-_"); | |
return ucwords($filename); | |
} |
How do you sort a list of words on the 4th character of the word? What"s the shortest solution?
[ "strawberry", "helicopter", "wales", "acorn" ]
should be:
In this challenge you get an HTML document that renders a lot of colourful hearts.
And you get a JSON object with the information about all the brown colours that were used:
[
/* | |
<section> | |
<ul> | |
<li>HTML</li> | |
<li>CSS</li> | |
<li>JavaScript</li> | |
</ul> | |
<form> | |
<label for="tech">Add a technology</label> | |
<input type="text" name="tech" id="tech"> |
const csvToJSON = (csv) => { | |
const getcsvdata = (csv) => { | |
const csvRegex = /,(?=(?:(?:[^"]*"){2})*[^"]*$)/; | |
const trimQuotes = /^"|"$/g; | |
csv = csv.split(csvRegex).map( | |
h => h.trim().replace(trimQuotes, '') | |
); | |
return csv; | |
} | |
let lines = csv.split('\n'); |
It's not what you think… On the 29th of January CODE100 is coming to Amsterdam - you can get a ticket here to join the party and network or you can go the whole hog and apply as a challenger - remember, the winners get to the finals in July and last year's winner went home with 10,000 Euro prize money.
In any case, this time the puzzle is to celebrate Amsterdam and it's flag:
The challenge is to take a collection of 292 games of noughts and crosses (or Tic Tac Toe) and to find out how many were won by the player using the X like shown in this animation: