Skip to content

Instantly share code, notes, and snippets.

View mattswann's full-sized avatar

Matt Swann mattswann

  • BFA Industries
  • Australia
View GitHub Profile
Warm up One.
A traveller comes to a fork in the road which leads to two villages. In one village the people always tell lies, and in the other village the people always tell the truth. The traveller needs to conduct business in the village where everyone tells the truth. A man from one of the villages is standing in the middle of the fork, but there is no indication of which village he is from. The traveller approaches the man and asks him one question. From the villager's answer, he knows which road to follow. What did the traveller ask?
Warm up Two.
A man walks into an art gallery and concentrates on one picture in particular. The museum curator notices this and asks the man why he is so interested in that one painting. The man replies, "Brothers and sisters have I none, but that man's father is my father's son."
Who is in the painting?
Warm up Three.
@mattswann
mattswann / BrainGymAnswers.md
Last active December 7, 2015 22:12
BrainGym Answers

Warm up One

A traveller comes to a fork in the road which leads to two villages. In one village the people always tell lies, and in the other village the people always tell the truth. The traveller needs to conduct business in the village where everyone tells the truth. A man from one of the villages is standing in the middle of the fork, but there is no indication of which village he is from. The traveller approaches the man and asks him one question. From the villager's answer, he knows which road to follow. What did the traveller ask?

Answer: The traveller asked "which road goes to your village". He would then take the road the villager pointed to because a truthful person would point toward the truthful village,and the liar would also point to the truthful village since he is a liar and, therefore, could not point to his own village.

Warm up Two

###Mini Golf Scores

####Exercise Bob, Jimbo and Fish love mini golf. But, like all good golfers they enjoy the 19th hole the most. Every time they hand in their score cards none of the scores are ever totalled. Write a function called totalScores in JS that calculates their scores and 'console.logs' the total for the club house.

#####Bob

Hole 1 = 3 Hole 2 = 2 Hole 3 = 6 Hole 4 = 11

###Mini Golf Scores

####Exercise Bob, Jimbo and Fish love mini golf. But, like all good golfers they enjoy the 19th hole the most. Every time they hand in their score cards none of the scores are ever totalled. Write a function called totalScores in JS that calculates their scores and 'console.logs' the total for the club house.

#####Bob

  • Hole 1 = 3
  • Hole 2 = 2
  • Hole 3 = 6
  • Hole 4 = 11

###PT PLANNER ####Melbourne Public Transport Journey Planner

There are 3 train lines:

The Alamein line has the following stops: Flinders Street, Richmond, East Richmond, Burnley, Hawthorn, and Glenferrie.

The Glen Waverly line has the following stops: Flagstaff, Melbourne Central, Parliament, Richmond, Kooyong and Tooronga.

The Sandringham line has the following stops: Southern Cross, Richmond, South Yarra, Prahran, and Windsor.

@mattswann
mattswann / startup.md
Last active December 8, 2015 22:00
WarmUp D3

##This for That Startup Idea Generator

Write a function that answers the question "What does your startup do?"

Here is some starter code:

var thisArray = ["Skynet","Digital Music Distribution","FitBit","Realtime Data","ManPacks","Landing Page","Conversion Funnel","Social Network","Airbnb","SnapChat","Bang With Friends","HTML5 App","Google Analytics","Mapreduce Query","Node.js Server","KickStarter","Match.com","Adultfriendfinder","Pinterest","Amber Alert System","Groupon","Appstore","Digital Magazine","Distributed Social Network","Quadcopter","Daring Fireball","Content Distribution Network","Analytics Platform","OpenTable","LinkedIn","Brick and Mortar Solution","Aggregator","Social Game","jQuery Plugin","Game-based Incentive","Foursquare","YouTube","WeedMaps","Texts From Last Night","Ponzi Scheme","1-800-Flowers","Cash4Gold","Online Marketplace","Viral Marketer","Wearable Computer","Google Glass App","Facebook Marketplace","Zivity","Playboy","Cloud Storage Provider","Kindle Fire App","Pandora","Green Tech P

###Days of our Lives


In a new js file, create an array (and assign it to a variable) containing the days of the week as strings, with Monday as the first and Sunday as the last.

My calendar says Sunday is the first day of the week. Write code to move Sunday from the end of the array to the beginning.

I'm really excited about Friday for some reason. Write code to find that day in the array and make it all uppercase.

@mattswann
mattswann / paddy.md
Last active August 29, 2015 14:17
PaddyWarmup

##Talk to paddy


#####Setup

  1. Create a paddy.js file
  2. Create a paddy.css file
  3. Create a paddy.html file

#####Paddy

@mattswann
mattswann / LifeDecider.md
Last active August 29, 2015 14:17
Never make another difficult decision again...

###The Ultimate Life Decider Never make a decision again!

####Part One a. - The Coin of Inevitability


  1. Create a file called decider.js
  2. Write a function called coinFlip that 'console.logs' HEADS or TAILS when called
  3. Add a counter that declares WINNER in the console when either HEADS or TAILS is flipped 5 times.

Array practice

###Part 1

Given the following arrays:

var hari = ["hari", 50, "sananab"]
var tony = ["tony", 17, "regal"]