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
package Mojo::UserAgent::OAuth; | |
use Mojo::Base -base; | |
use Mojo::URL; | |
use Net::OAuth; | |
our $VERSION = 0.01; |
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
#!/usr/bin/env perl6 | |
my Int @digits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | |
loop { | |
my $changed = False; | |
for [0..9] -> $digit { | |
my $count = @digits.grep($digit).elems; |
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 Control.Monad | |
import Data.Char | |
import Data.Maybe | |
import Data.List | |
main = do | |
[n, q] <- replicateM 2 (fmap read getLine) | |
types <- replicateM n (fmap ((\ [x, y] -> (map toLower x, y)) . words) getLine) | |
replicateM q $ do | |
ext <- fmap (extension . map toLower) getLine |
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 System.IO | |
main = do | |
hSetBuffering stdout NoBuffering -- DO NOT REMOVE | |
[lightx, lighty, initialtx, initialty] <- fmap (map read . words) getLine | |
mapM_ (\ x -> getLine >> putStrLn x) (path initialtx initialty lightx lighty) | |
path x y lx ly = | |
zipWith (++) (direction "S" "N" (y - ly)) (direction "E" "W" (x - lx)) | |
where |
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 System.IO | |
import Data.List | |
import Data.Ord | |
main = do | |
hSetBuffering stdout NoBuffering | |
n <- fmap read getLine | |
if n == 0 | |
then print 0 | |
else getLine >>= print . head . sortOn abs . reverse . sort . map read . words |
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 System.IO | |
import Control.Monad | |
main = do | |
hSetBuffering stdout NoBuffering -- DO NOT REMOVE | |
[road, gap, platform] <- replicateM 3 (fmap read getLine) | |
forever $ do | |
[speed, x] <- replicateM 2 (fmap read getLine) |
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 Data.List | |
import Data.Ord | |
import System.IO | |
import Control.Monad | |
type Node = Int | |
type Gateway = Node | |
type Link = (Node, Node) | |
type Path = [Link] |
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 System.IO | |
import Control.Monad | |
import Data.List | |
main = do | |
hSetBuffering stdout NoBuffering -- DO NOT REMOVE | |
count <- fmap read getLine | |
strengths <- fmap sort (replicateM count (fmap read getLine)) |
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 Control.Monad | |
import Data.List | |
main = do | |
[ _, height ] <- replicateM 2 (fmap read getLine) | |
cells <- fmap concat (forM [0 .. height - 1] (\ y -> fmap (parseRow y) getLine)) | |
forM cells (putStrLn . findNext cells) | |
where | |
parseRow y cells = map ((,) y . fst) $ filter ((==) '0' . snd) $ zip [0..] cells |
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
use Blurgh; | |
class Blog::Post does Blurgh::Route[:('post')] { | |
state %posts; | |
state $next-post-id = 1; | |
# Matches "GET /post/123" (only if integer exists in %posts) | |
multi method get(Int:D $id where { %posts{$_}:exists }) { | |
$.render(:text(%posts{$id})); | |
} |