Skip to content

Instantly share code, notes, and snippets.

View lyntco's full-sized avatar

Lyn Cooper lyntco

  • Sydney Australia
View GitHub Profile
@lyntco
lyntco / ToggleColorScheme.py
Last active August 29, 2015 14:03
toggle color scheme
import sublime, sublime_plugin
class ToggleColorSchemeCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
light_scheme = "Packages/User/Solarized (Light) (SL).tmTheme"
dark_scheme = args["dark_color_scheme"]
settings = sublime.load_settings('Preferences.sublime-settings')
current_scheme = settings.get('color_scheme')
@lyntco
lyntco / q001-leapyear.md
Last active August 29, 2015 14:07
QUIZ-1 Leap year

Quiz-1 Leap Year


Write a program that will tell you whether a year is a leap year.

A leap year is a year divisible by 4 unless it is also divisible by 100. If the year is divisible by 400, it is a leap year.

leap_year?(1840) # => true
@lyntco
lyntco / q002-bob.md
Created October 1, 2014 06:35
Quiz 2 - Bob

Quiz - 2 Talk to Bob


Bob is a teenager. He doesn't say a lot.

When you ask him a question, he'll reply, "Yeah whatever man"

When you say a sentence, he'll reply, "Cool, bro"

When you yell at him he should reply "WOAH, CHILL OUT MAN"

@lyntco
lyntco / q003-granny.md
Last active August 29, 2015 14:07
Quiz-3 Talk to Granny

Quiz-3 Talk to Grandma


Granny's hard at hearing.

If you talk to Granny normally, she'll reply "SPEAK UP SONNY JIM"

If you talk to her in ALL CAPS, she'll reply "NO, NOT SINCE 1945"

The year will be a random year between 1930 and 1950.

@lyntco
lyntco / q004-palindrome.md
Last active August 29, 2015 14:07
Quiz-4 Palindrome

Quiz 4 Palindrome

Write a program that checks whether input is a palindrome or not.

Example method call:

is_palindrome?('maddam') # => true
is_palindrome?("a man a plan a canal panama") # => true
@lyntco
lyntco / q005-scrabble.md
Last active August 29, 2015 14:07
Quiz-5 Scrabble

Quiz-5 Scrabble Score

Write a program that, given a word, computes the scrabble score for that word.

Scrabble.score("cabbage")
# => 14

Your program should be in a file named scrabble.rb.

@lyntco
lyntco / q006-robots.md
Last active August 29, 2015 14:07
Quiz-6 Robots

Quiz-6 Robot Name

When robots come off the factory floor, they have no name.

The first time you boot them up, a random name is generated, such as RX837 or BC811.

In other words, if I say:

puts "Robot 1: "
@lyntco
lyntco / q007-gradeschool.md
Created October 1, 2014 08:19
Quiz-7 Grade school

Quiz-7 Grade School

Write a small archiving program that stores students along with the grade that they are in.

school = School.new("Haleakala Hippy School")

If no students have been added, the db should be empty:

@lyntco
lyntco / q008-anagramdetector.md
Last active August 29, 2015 14:07
Quiz-8 Anagram Detector

Quiz-8 Anagram Detector

Write a program that, given a word and a list of possible anagrams, selects the correct one(s).

In other words, given: "listen" and %w(enlists google inlets banana) the program should return "inlets".

Run it like so:

find_anagram("listen", %w(enlists google inlets banana))
# => "Inlets is the Anagram for Listen"
@lyntco
lyntco / q009-sayinenglish.md
Last active August 29, 2015 14:07
Quiz-9 Say it in Engish

Say it in English

Write a program that will take a number from 0 to 99 and spell out that number in English.

In other words, if the input to the program is 22, then the output should be 'twenty-two'

e.g.

Say.new(22).in_english