Skip to content

Instantly share code, notes, and snippets.

View kenmazaika's full-sized avatar

ken mazaika kenmazaika

View GitHub Profile
class OrderItem < ActiveRecord::Base
validate :validate_supply_is_good
def validate_supply_is_good
if quantity > supply.quantity # only if the order_item quantity is larger than the supplier's we add the message
# add the error to the quantity field. Add the message about the reason.
errors.add(:quantity, "Quanity exceeds seller's capacity")
end
end
end
@kenmazaika
kenmazaika / fb.html
Created July 25, 2014 22:49
streaming
<script src="https://cdn.firebase.com/js/client/1.0.18/firebase.js"></script>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(function() {
var myFirebaseRef = new Firebase("https://brilliant-fire-738.firebaseio.com/");
myFirebaseRef.child("todos").on("child_added", function(snapshot) {
.featured-image img {
display:none;
}
.featured-image {
width:100%;
background: url(http://blog.thefirehoseproject.com/wp-content/uploads/2014/07/coder_at_computer.jpg) no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;

How to Setup a Virtual Web Development Environment

Instructions:

  • Go to nitrous.io
  • Create an account
  • Check email, confirm account
  • Click "Open Dashboard"
  • Leave Ruby/Rails selected
  • Select Region of "US East"
<body class="Site">
<style>
.Site {
display: flex;
min-height: 100vh;
flex-direction: column;
}
.Site-content {
flex: 1;
def fizbuzz(number)
# fill this in to "puts" the correct element to the screen
end
fizbuzz(1)
fiz
fizbuzz(2)
fiz
fiz

Hey Jay -

Congrats on the job and awesome application. I went to your application and it looks like users get error messages when they try to sign up for an account.

Out of curiosity I googled around and found your GitHub page (where people can share and collaborate on code and web applications).

I looked into the problem a little, and even though I don't have access to your server, I think by looking into the code I see what the problem is.

In short, I think what's happening is when users go to sign up, they are supposed to get a confirmation email to their account, and when your web application is going to send the email out, it's causing problems. Here's the details of the problem, and how to fix it.

def fizzbuz(n=1000)
n.times do |n|
puts n % 3 != 0 ? "fizz" : "buzz"
end
end
def fizzbuz( n ):
for i in xrange(1, n+1):
elif i % 3 != 0:
print "Fizz"
else:
print "Buzz"
function fizzbuz(n) {
for (var i = 1; i <= n+1; i++) {
if (i % 3 !== 0) {
console.log('Fizz');
} else {
console.log('Buzz');
}
}
}