gem install pry
gem install gist
gist --login # otherwise it will post anon
gist file.rb
# => https://gist.github.com/34ebbc09i62fd7909565
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
$('.home_details').css("margin-top", function(){ | |
if ($(window).height() > 642) { | |
return "0px"; | |
} else { | |
return (((642 - $(window).height())) / 6.8) + "px"; | |
console.log(737 - ($(window).height()) + "px"); | |
} | |
}); |
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
require 'factory_girl' | |
FactoryGirl.define do | |
factory :user do | |
name 'Pete' | |
end | |
factory :registration do | |
title 'Summer Class' | |
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
require 'pry' | |
require 'debugger' | |
x = %q[This is a dank video <iframe width="560" height="315" src="//www.youtube.com/embed/dGd9DTTrX4U" frameborder="0" allowfullscreen></iframe>] | |
array = x.split('<iframe') | |
array.delete('') | |
new_hash = {} | |
array.each do |str| |
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
while y != "no": | |
print ">>>> M value is: ", m | |
s = int(raw_input(">>> Which Servo? >> ")) | |
if s == 2 | |
# here we need to set it to go up and down | |
else | |
m = int(raw_input(">>> Where? >> ")) | |
if m > 149 and m < 601: | |
pwm.setPWM(s, 0, m) | |
elif m < 150: |
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
[{ | |
"identifier": "111111", | |
"name":"ABC Heating and Cooling", | |
"contact":{"phone":"", | |
"email":"", | |
"address":{"street1":"3266 Investment Blvd", | |
"city":"Hayward", | |
"state":"CA", | |
"zipcode":"94545" | |
} |
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
{ | |
"location_id" => "aBV0000000000003Estl", | |
"location_name" => "ABC Heating Jungle Location", | |
"contractor_id" => "BHh747874000Estbnl", | |
"dba_name" => "ABC Heating", | |
"website_url" => "www.abcheating.com", | |
"contact" => { | |
"phone" => "555-555-5555", | |
"email" => "[email protected]", | |
"address" => { |
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
# 6. The superclass of the singleton class of an object is the object's class. | |
# The superclass of the singleton class of a class is the singleton class | |
# of the class's superclass. | |
class Person; end | |
p = Person.new | |
puts p.singleton_class.superclass == p.class #=> true | |
puts Person.singleton_class.superclass == Person.superclass.singleton_class #=> true |
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 Person | |
# We all know this is for putting "class methods" | |
# on a class | |
# | |
# but this is actually a special syntax for moving into the scope | |
# of a singleton class | |
# | |
# in this case we are moving into the scope of self's singleton's | |
# class | |
# |
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
# CheckedAttributes Challenge | |
# | |
# Make the following two tests pass | |
# only by implementing the module CheckedAttributes | |
class Person | |
include CheckedAttributes | |
attr_checked :age do |v| | |
v >= 18 |
OlderNewer