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 to check if element is visible in viewport | |
const isVisible = (elem) => { | |
const rect = elem.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && | |
rect.right <= (window.innerWidth || document.documentElement.clientWidth) | |
); | |
}; |
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
[ | |
{ | |
"first_name": "Emma", | |
"last_name": "Johnson", | |
"full_name": "Emma Johnson", | |
"email": "[email protected]", | |
"encrypted_password": "a8a3db3d3c0a2a2", | |
"reset_password_token": "t9a0e4f8a4e4", | |
"confirm_token": "d8b8c7c6f5e4d3c", | |
"age": 28, |
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
# implicit | |
class ErrorReporter | |
def active? | |
Rails.environment.production? | |
end | |
end | |
Rails.environment.stub :production?, true do | |
assert ErrorReporter.active? | |
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
Had a dream last night, uncle greg was being attacked by the wire fence behind gramp's | |
house in the dark by two fierce raccoons. Clung around his upper body, they were bitting | |
him repeatedly around hischest and head. Suddenly, in rushes three year old Aaron, like | |
little Yoda...he stealthy climbs up greg's body and sits up behind his head, reaching down, | |
he grabs each raccoon's head and quickly breaks their necks..the scene quickly falls away.... | |
but you were left on the other side of the fence, I screamed, Come on, Aaron!! You can make it!!!" | |
You easily maneuver up the fence to the other side and I thought..."I guess a trip to the | |
hospital and two rabid shots are in order." Crazy dream...but I was wicked proud of you. | |
https://www.youtube.com/watch?v=NzcWQZ3yrNo |
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
Instructions for clearing expired DigiCert SSL certificate on OSX | |
NOTICE: The following instructions "worked for me." Proceed at your own risk. | |
Symptoms: | |
* Visiting several sites, such as github, gravatar, twitter's CDN results in "invalid certificate" errors | |
* For example: http://i.imgur.com/8gPRfI3.png | |
Instructions |
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
Tea Strainer - 9$ - https://www.harney.com/permanent-tea-filters.html | |
Black Tea - 6.25$/4oz - https://www.harney.com/irish-breakfast-tea.html | |
Green Tea - 12$/4oz - https://www.harney.com/japanese-sencha.html | |
Brew the Green for ~2 minutes in less than boiling water, no milk, maybe a little sugar. As for the black tea, 4 minutes, boiling water, milk & sugar. |
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
ruby '1.9.3' | |
def local_group(*g, &block) | |
on_heroku = (ENV['HOME'].gsub('/','') == 'app') | |
if on_heroku | |
group(:test, &block) | |
else | |
group(*g, &block) | |
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
email = '[email protected]'.gsub('%', '') | |
users = User.arel_table | |
User.find_by_sql( | |
users. | |
project(:id). | |
where(users[:email].matches email). | |
to_sql | |
).first |
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 UserSearch | |
def self.search(term, topic_id = nil) | |
scope = User.scoped | |
if topic_id | |
scope = scope.joins(" | |
LEFT JOIN ( | |
SELECT DISTINCT(posts.user_id) | |
FROM posts | |
WHERE topic_id = #{topic_id.to_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.3p327 :048 > t = User.new | |
=> #<User id: nil, name: nil, some_bool: nil, created_at: nil, updated_at: nil> | |
1.9.3p327 :049 > t.some_bool = 'a string' | |
=> "a string" | |
1.9.3p327 :050 > t.some_bool | |
=> false |
NewerOlder