This file contains 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.fn.fitToParent = function() | |
{ | |
this.each(function() | |
{ | |
var width = $(this).width(); | |
var height = $(this).height(); | |
var parentWidth = $(this).parent().width(); | |
var parentHeight = $(this).parent().height(); | |
if(width/parentWidth < height/parentHeight) |
This file contains 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
$(window).bind('orientationchange', function(){ | |
// do whatever | |
}); | |
// The below will give you the current orientation for iOS devices, possible values being 0, 90, -90 or 180 (180 on iPad only) | |
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { | |
alert(window.orientation); | |
} |
This file contains 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
# Installs migrations from unmountable engines | |
bundle exec rake railties:install:migrations FROM=<ENGINE-NAME>_engine |
This file contains 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
FAILED | |
http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata | |
Notes (cos I had to look up what Prime Factors were): | |
===================================================== | |
http://en.wikipedia.org/wiki/Prime_factor | |
Prime factors of a number are the prime numbers you would multiply together to get that original number as a result, e.g: |
This file contains 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
SUCCESS | |
## http://en.wikipedia.org/wiki/Pangram | |
Pangrams (also known as holoalphabetic sentences) are sentences in which every letter of the alphabet is featured at least once. | |
Write a script that will take a string and return true or false depending on whether that string is a pangram, as well a tally count for each letter of the alphabet. | |
Pangram examples: |
This file contains 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
FAILED | |
http://projecteuler.net/problem=2 | |
Each new term in the Fibonacci sequence is generated by adding the previous two terms. | |
By starting with 1 and 2, the first 10 terms will be: | |
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. |
This file contains 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
function Palindrome () { }; | |
Palindrome.prototype.isPalindrome = function (candidate) { | |
reversedCandidate = candidate.toString().split("").reverse().join(""); | |
return candidate.toString() == reversedCandidate; | |
}; | |
Palindrome.prototype.product = function (number1, number2) { | |
return number1 * number2; |
This file contains 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
If the numbers 1 to 5 are written out in words: one, two, three, four, five | |
then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. | |
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? | |
NOTE: | |
Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage. |
This file contains 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
Rock Paper Scissors Lizard Spock is a more convoluted and much geekier version of Rock Paper Scissors. | |
The rules are: | |
Rock beats Scissors | |
Rock crushes Lizard | |
Paper covers Rock | |
Paper disproves Spock | |
Scissors cut Paper | |
Scissors decapitate Lizard |
This file contains 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
# time in Vagrant seems to fall out of sync fairly often (albeit very slowly) | |
# and can fuck with some oauth requests - this syncs it back up: | |
sudo ntpdate pool.ntp.org |
OlderNewer