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
genres: | |
- name: Classic Rock | |
artists: | |
- name: Led Zeppelin | |
albums: | |
- name: I | |
tracks: | |
- name: Babe, I'm Gonna Leave You | |
- name: Black Mountain Side | |
- name: Communication Breakdown |
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
{ | |
"id" => 1009521, | |
"name" => " Hank Pym", | |
"comics" => { | |
"available" => 44, | |
"collectionURI" => "http://gateway.marvel.com/v1/public/characters/1009521/comics", | |
"items" => [ | |
[ 0] { | |
"resourceURI" => "http://gateway.marvel.com/v1/public/comics/35533", | |
"name" => "Amazing Spider-Man (1999) #661" |
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
def factors(n): | |
count = 0 | |
for i in range(1, n): | |
if n % i == 0: | |
count = count + 1 | |
if count >= 500 | |
return true |
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
sum = 0 | |
1000.times do |x| | |
sum += x if x % 3 == 0 || x % 5 == 0 | |
end | |
puts sum |
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
#!/usr/bin/env ruby | |
require 'bundler' | |
gems = ARGV | |
if gems.empty? | |
puts "Updating all gems" | |
Bundler.definition(true) |
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
Autotest.add_hook :initialize do |autotest| | |
%w{.git .svn .hg .DS_Store ._* vendor tmp log doc solr}.each do |exception| | |
autotest.add_exception(exception) | |
end | |
end |
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
class Rating < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :rater, :class_name => 'User', :foreign_key => 'rater_id' | |
belongs_to :account | |
attr_accessible :score, :rater_id, :user_id, :rater, :user | |
VALID_SCORES = 1..3 | |
validates_presence_of :score, :user_id, :rater_id, :account_id |
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
<p id="redirect_to">You will be redirected to the following URL in 5 seconds: <a id="redirect_url" href="<your link's url>"><Your link's url></a></p> |
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
<script type="text/javascript"> | |
$(document).ready(function() { | |
var href = $("#redirect_url")[0].href; | |
$("a#replace_me").attr("href", href); | |
$("a#replace_me").text(href); | |
$("#redirect_to").hide(); | |
}); | |
</script> | |
<p>Greetings. We are now redirecting you to the site that you requested.</p> |
NewerOlder