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
var PS = {}; | |
// Either need to rename FFI modules (e.g. `$PS["Effect.Console.FFI"]`) or else | |
// combine them as shown here to avoid recursive promise calls | |
(function($PS) { | |
$PS["Effect.Console"] = $PS["Effect.Console"] || Promise.resolve({}); | |
$PS["Effect.Console"] = $PS["Effect.Console"].then(exports => { | |
exports["log"] = function(s) { | |
return function() { | |
console.log(s); |
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
# FizzBuzz | |
Write a program that prints the numbers from 1 to 100, except: | |
- For multiples of 3, print "Fizz" instead of the number | |
- For multiples of 5, print "Buzz" instead of the number | |
- For multiples of both 3 and 5, print "FizzBuzz" instead of the number | |
## Extension |
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
# DNA sequences | |
You're working in a scientific laboratory that specialises in DNA research. Cool! | |
Each sequence of DNA is made up of four bases: A, C, G and T. Your job is to count how many times each base appears in a particular sequence. You quickly get bored of doing this by hand and decide to write a program to do it for you. | |
You have the following sequence: | |
`"GCAACTCTCTATTGTGCCGGAAGTTAATATGCAAAGAGTAATTTCCCATCCCCACTACCGAATCCCTGACCAACCGCCTTCTTCAGGGTGATTACGTGCTAAGCTTATTAGCGCTCTCTTTTCCGATTCACTGTTCAAGATCGTCATTTTCGGGACCATTCCTTGATTCACACACTGAACGATTATGAGGTGTATACGAAACGGGTAGAGGCCCGCAAATGCGTCCTCGATACAGATGCTCGGGTCTGTTCCTGCACGGGCACGTAAACAGCGTGTTAAGGGAGAAAGTGTGAGTGTGAAGATGAATTAAAGGCTTATCAGCCACGGCTTCAAAGACTATAGCAACGCAGAGGAACCGAGCATTTCCATCCCAGCTCATGGTAATTTACTACGGGAGCTAACGCCAGAGGTAATATTTCTG TCTGGCAGGTTTTATTAGCCGGGTGGGAGGGAGGAAGGAGTTGAAACTCGTTACCCAATTACTCGAAGGTGTACTATTACTTCTTTGGAGATCAACTGCAGTTTGCTTGGTAACACTCACATATAAATTGTGTACTGGGTCCCATTACTTTTTCTAGGGAGTAATTAAGTTATCCCTTAGCGAATATGATGCGGCTTTGGCTTTTGGCTTAACTACCCGAAAACCAGT |
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
# String matrices | |
You're working on a piece of code that deals with matrices of numbers. Unfortunately, you have to integrate with a legacy system that gives you the matrices as strings. | |
The legacy system gives you some strings like so: | |
`1,2,3 4,5,6 7,8,9` | |
All rows are guaranteed to be the same length (you don't have to check for this) and are separated by spaces. Numbers in a row do _not_ have spaces between them and are separated by commas. |
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
# School years | |
You're helping your school design a new admin system. You've been given a list of students' names along with their school year. The data looks like so: | |
Name | Year | |
--------|----- | |
Amy | 1 | |
Bob | 3 | |
Charlie | 2 |
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 React as React | |
import React.DOM as DOM | |
import React.DOM.Props as Props | |
import React.SyntheticEvent (currentTarget) | |
import Web.HTML.HTMLElement (focus) | |
import Unsafe.Coerce (unsafeCoerce) | |
type MyState |
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
-- In `f` we want to keep piping (part of) the result of one function into | |
-- another, and stop as soon as something fails | |
f :: [A] -> Either String (B, [A]) | |
f xs = | |
case f1 xs of | |
Left s -> Left s | |
Right (res1, xs') -> | |
case f2 xs' of | |
Left s -> Left s | |
Right (res2, xs'') -> |
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
// Fab Four technique: https://medium.freecodecamp.com/the-fab-four-technique-to-create-responsive-emails-without-media-queries-baf11fdfa848#.65xejb13e | |
// (Credit to Rémi Parmentier) | |
// This SASS mixin can be applied to each responsive block | |
// The parent container of such blocks will want to use `font-size: 0;` to avoid inline-block spacing issues | |
@mixin responsive ($mobilePc, $desktopPc, $desktopAbs, $bp: 660, $neg: false) { | |
display: inline-block; | |
vertical-align: top; | |
// Mobile size as a % |