Skip to content

Instantly share code, notes, and snippets.

View CaseyLeask's full-sized avatar

Casey Leask CaseyLeask

  • Melbourne :: Australia
View GitHub Profile
var router = Router.create({
routes,
location,
onAbort: function defaultAbortHandler(abortReason) {
reject(abortReason);
}
});
router.run(function (Handler, State) {
import scala.io.StdIn.{readInt,readLine}
import scala.io.Source
object Solution {
def main(args: Array[String]) {
val count = readInt()
val phoneBook = (1 to count).foldLeft(List[String]())((phoneBook, _) => {
readLine().split(" ") match {
case Array(k, v) if v.endsWith("@gmail.com") => phoneBook :+ k
case _ => phoneBook
-module(solution).
-export([main/0]).
main() ->
printContacts(sortContacts(filterContacts(createContacts(readAll())))).
readAll() ->
readAll([], io:get_chars("", 4096)).
readAll(In, eof) ->
[StringN|Lines] = string:tokens(lists:flatten(lists:reverse(In)), "\n"),
use std::io;
use std::io::BufRead;
fn main() {
let stdin = io::stdin();
let lines: Vec<std::string::String> = stdin.lock().lines().map(|l| l.unwrap()).collect();
let trimmed = lines[0].trim();
let mut count = 0;
import scala.io.StdIn.{readLine}
import scala.io.Source
import java.util.{GregorianCalendar, Calendar}
object Solution {
def main(args: Array[String]) {
val actualCalendar = createCalendar(readLine())
val expectedCalendar = createCalendar(readLine())
val (diffYear, diffMonth, diffDay) = calculateDateDiff(actualCalendar, expectedCalendar)
% Enter your code here. Read input from STDIN. Print output to STDOUT
% Your class should be named solution
-module(solution).
-export([main/0]).
main() ->
DateReturned = readDate(),
DueDate = readDate(),
DateDiff = calculateDifference(DateReturned, DueDate),
use std::io;
use std::io::BufRead;
fn main() {
let stdin = io::stdin();
let lines: Vec<std::string::String> = stdin.lock().lines().map(|l| l.unwrap()).collect();
let date_returned_vec: Vec<&str> = lines[0].split_whitespace().collect();
let due_date_vec: Vec<&str> = lines[1].split_whitespace().collect();
let date_returned = construct_date(date_returned_vec[0], date_returned_vec[1], date_returned_vec[2]);
import scala.io.StdIn.{readInt,readLine}
import scala.io.Source
object Solution {
def main(args: Array[String]) {
val count = readInt()
val phoneBook = (1 to count).foldLeft(Map[String, String]())((phoneBook, _) => {
readLine().split(" ") match {
case Array(k, v) => phoneBook + (k -> v)
% Enter your code here. Read input from STDIN. Print output to STDOUT
% Your class should be named solution
-module(solution).
-export([main/0]).
main() ->
runQueries(createPhoneBook(readAll())).
readAll() ->
use std::io;
use std::io::BufRead;
use std::collections::HashMap;
fn main() {
let stdin = io::stdin();
let lines: Vec<std::string::String> = stdin.lock().lines().map(|l| l.unwrap()).collect();
let trimmed = lines[0].trim();
let mut count = 0;