This file contains hidden or 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
# Write a function which takes a number N of cats and outputs which cats have | |
# hats. Initially, none of the cats have hats. You walk down the line of cats, | |
# stopping at every cat, taking off its hat if it has one or putting on a hat | |
# if it doesn't have one. On the second round, you only stop at every second | |
# cat [eg #2, #4, #6], on the third round you stop at every third cat [eg #3, | |
# #6, #9...]. You continue this until you've done as many round as there are | |
# cats. Your function should output an array containing booleans indicating | |
# whether each cat has a hat or not by the end. | |
def cats_in_hats(num_cats) |
This file contains hidden or 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
# Write a method ordered_vowel_words that takes a string of lowercase words | |
# and returns a string with just the words containing all their vowels | |
# (excluding "y") in alphabetical order | |
def ordered_vowel_words(words) | |
vowels = %w(a e i o u) | |
ordered = [] | |
words.split(" ").each do |word| | |
word_vowels = word.chars.select { |char| vowels.include? char } # amends = ae, complicated = oiae | |
ordered << word if word_vowels == word_vowels.sort |
This file contains hidden or 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
jQuery.noConflict(); | |
(function ($) { | |
// your code in here can safely use $ for jQuery | |
})(jQuery); | |
// code using $ for another library |
This file contains hidden or 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
require 'rspec' | |
def ordered_vowel_words(words) | |
words.split(" ").inject([]) do |valid_words, word| | |
vowels = word.scan(/[aeiou]/) | |
valid_words.tap { |w| w << word if vowels == vowels.sort } | |
end.join(" ") | |
end | |
describe "#ordered_vowel_words" do |
This file contains hidden or 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
// Complete the solution so that it splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the final pair with an underscore ('_'). | |
// Examples: | |
// solution('abc') // should return ['ab', 'c_'] | |
// solution('abcdef') // should return ['ab', 'cd', 'ef'] | |
function paddedPairs(str) { | |
var pairs = ['']; | |
for (var i = 0; i < str.length; i++) { |
This file contains hidden or 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
require 'benchmark' | |
require 'set' | |
def ordered_vowel_words_regex(words) | |
valid_words = [] | |
words.split(" ").each do |word| | |
vowels = word.scan(/[aeiou]/) | |
valid_words << word if vowels == vowels.sort | |
end | |
valid_words.join(" ") |
This file contains hidden or 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
Show hidden characters
{ | |
"detect_indentation": false, | |
"draw_white_space": "all", | |
"font_size": 17.0, | |
"ignored_packages": | |
[ | |
"Vintage", | |
"Handlebars", | |
"ColorPick" | |
], |
This file contains hidden or 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
Wordlist ver 0.732 - EXPECT INCOMPATIBLE CHANGES; | |
acrobat africa alaska albert albino album | |
alcohol alex alpha amadeus amanda amazon | |
america analog animal antenna antonio apollo | |
april aroma artist aspirin athlete atlas | |
banana bandit banjo bikini bingo bonus | |
camera canada carbon casino catalog cinema | |
citizen cobra comet compact complex context | |
credit critic crystal culture david delta | |
dialog diploma doctor domino dragon drama |
This file contains hidden or 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
// mixins/hookup_container.js | |
App.HookupContainer = Ember.Mixin.create({ | |
// https://github.com/tehviking/giffindor/issues/1#issuecomment-51066764 | |
hookupContainer: function() { | |
this.container = SoftLacrosse.__container__; | |
}.on('init'), | |
}); | |
// components/my_component.js | |
App.MyComponent = Ember.Component.extend( |
This file contains hidden or 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
{ | |
"detect_indentation": false, | |
"draw_white_space": "all", | |
"font_size": 17.0, | |
"indent_to_bracket": true, | |
"rulers": | |
[ | |
80 | |
], | |
"show_full_path": true, |