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
hi |
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
1.upto(100) { |i| puts i%3==0?i%5==0?"FizzBuzz":"Fizz":i%5==0?'Buzz':i} |
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
1.9.3p448 :015 > j.deadline_at = DateTime.parse('04 Dec 2013 09:30:00' ) <- setting time with DateTime object | |
=> Wed, 04 Dec 2013 09:30:00 +0000 | |
1.9.3p448 :016 > reload! | |
Reloading... | |
=> true | |
1.9.3p448 :017 > j.deadline_at | |
=> Wed, 04 Dec 2013 01:30:00 PST -08:00 <- Mongo Mapper assumes it is in UTC, reformats it into a Time object. | |
1.9.3p448 :018 > j.deadline_at = Time.parse('04 Dec 2013 09:30:00' ) <- setting time with Time | |
=> 2013-12-04 09:30:00 -0800 | |
1.9.3p448 :019 > j.save! |
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
var readline = "The rain in Spain falls mainly on the plain."; | |
## L should be downcase | |
var LongestWord = function(sen) { | |
var words = sen.split(" "); | |
var longest = 0; | |
for (i = 0; i <= words.length; i++) { | |
if (longest.length < words[i].length) { | |
longest = words[i]; |
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
1. Should I shoulda-matchers in place of something like: | |
expect(Contact.new(firstname: nil)).to have(1).errors_on(:firstname) | |
2. When should I use let(:variable) {something} vs. using variable = something | |
expect(Contact.new(lastname: nil)).to have(1).errors_on(:lastname) | |
Assertions | |
.to | |
.to_be |
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
http://blog.assimov.net/blog/2010/12/18/twitter-integration-with-omniauth-and-devise-on-rails-3/ |
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
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
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 assert(test, message) { | |
if (!test) { | |
throw "ERROR: " + message; | |
} | |
return true; | |
} | |
function Animal(name, legs){ | |
this.name = name; | |
this.legs = legs; |
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
class Game < ActiveRecord::Base | |
has_and_belongs_to_many :users | |
belongs_to :winner, :class_name => "User" | |
end | |
class User < ActiveRecord::Base | |
has_and_belongs_to_many :games | |
validates :name, :uniqueness => true | |
end |
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
/* Here is your chance to take over Socrates! | |
Spend 10 minutes on each of the following hacks to the socrates website. | |
Enter them in the console to make sure it works and then save | |
your results here. | |
Choose a new pair for each. Add your names to the section you complete. | |
*/ | |
NewerOlder