Skip to content

Instantly share code, notes, and snippets.

View mattswann's full-sized avatar

Matt Swann mattswann

  • BFA Industries
  • Australia
View GitHub Profile

###REVERSE STRING

Create a function named "reverse" for the String prototype that will allow the following functionality:

EXAMPLE:

"String".reverse();         //=> returns "gnirtS"
"I like cookies".reverse(); //=> "seikooc ekil I"

##How many lightsabers do you own?


Inspired by the development team at Vooza, write the function "howManyLightsabersDoYouOwn"" that accepts the name of a programmer, and returns the number of lightsabers owned by that person. The only person who owns lightsabers is Zach, by the way. He owns 18, which is an awesome number of lightsabers. Anyone else owns 0.


howManyLightsabersDoYouOwn("anyone else") \\ should === 0

howManyLightsabersDoYouOwn("Zach") \ should === 18

@mattswann
mattswann / makegoogle.md
Created March 29, 2015 22:04
makegoogle

###Make Google CSS

How much do you love google, doodles? Now you can save them for eva!

Make a HTML docment and CSS file that replicates the google.com home page with your favourite doodle from

http://www.google.com/doodles

You page must 'look' realistic including the search box and buttons.

@mattswann
mattswann / Lunch.md
Last active August 29, 2015 14:18
Lunch time Cards

Lunch Orders

It's approaching lunch hour… let's collect orders. Create a new file called lunch_orders.rb to complete this exercise.

  1. Create a program that collects lunch orders. Prompt:
    • Name for order: (enter name)
    • {name} wants to order: (enter item)
  2. Store the name/order data. When storing data, do it in such a way that additional order items may be added for the person's name.
    • Example: Greg can order a Burger, and then add Fries to his order later.
  3. After storing data, prompt the user with:
@mattswann
mattswann / Allergies_test.rb
Last active August 29, 2015 14:20
Allergy warm up...
require 'minitest/autorun'
require 'minitest/reporters' # optional
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new() # optional
require_relative './allergies'
class AllergiesTest < MiniTest::Test

#Install WDI_MELB style

##Stage 1 - Ruby Version Manager

go to rvm.io copy and paste the two commands

command no. 1

@mattswann
mattswann / magicballs.md
Created July 9, 2015 23:09
They're magic!

#####Magic Balls


  1. Create a file called magic8ball.js
  2. Make a JS function that randomly returns one of the following strings to the console when called...

"No", "Not today", "It is decidedly so",

##Getting Close

You and some friends usually play a gathering game (like a scavenger hunt) using geo-coordinates in a park, but it has gotten so popular that many people want to join in. One of your friends created an API. An API is a way us getting data from a service. for people to add items hidden in the park, but now you want to build an App to help people decide what to find in the park.

You are given the following set of data as a result back from an API request and you want to sort those results in terms of proximity to the user of your site.

var myResults = [ {name: "six pack of beer", location: {lat: 37.767182, long: -122.5}},
          {name: "whacky glasses", location: {lat: 37.767182, long: -122.51}},
          {name: "whiskey bottle", location: {lat: 37.767282, long: -122.49}},

Ruby Squares!

squares

A perfect square is defined as a whole number that when square rooted is a whole number (such as 1, 4, 9, 16, etc.).

Make a new file called get_squares.rb.

Word Balance

We're going to balance words on one of the letters in them.

We'll use the position and letter itself to calculate the weight around the balance point. A word can be balanced if the weight on either side of the balance point is equal. Not all words can be balanced, but those that can are interesting for this challenge.

The formula to calculate the weight of the word is to look at the letter position in the English alphabet (so A=1, B=2, C=3 ... Z=26) as the letter weight, then multiply that by the distance from the balance point, so the first letter away is multiplied by 1, the second away by 2, etc.

As an example: