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
module.exports = function liveReload(opt) { | |
var opt = opt || {}; | |
var port = opt.port || 35729; | |
var excludeList = opt.excludeList || ['.woff', '.js', '.css', '.ico']; | |
function getSnippet() { | |
/*jshint quotmark:false */ | |
var snippet = [ | |
"<!-- livereload script -->", | |
"<script type=\"text/javascript\">document.write('<script src=\"http://'", |
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 is Charles, and I'm going to write just a tiny bit of code. | |
# I hope it'll clear things up for you. | |
# I think you're getting tripped up on stuff you've learned before - | |
# please try to approach this stuff with an open mind. It requires | |
# patience, but you'll eventually get the hang of it, I promise. | |
# These early steps are supposed to be hard! Patience now will | |
# pay off tenfold in a few weeks. | |
# I see you doing things that you must have seen in other languages! | |
# That's cool, but please be patient and really |
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
def greet(name) | |
"Hello #{name}!" | |
end | |
# Copy and paste that into irb. | |
# then type: | |
# greet("Zaidi") | |
# Pretty clear, right? | |
# Now, let's do something a little more interesting. |
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
<h1><%= markdown @post.title %></h1> | |
<div class="row"> | |
<div class="col-md-8"> | |
<small> | |
<%= image_tag(@post.user.avatar.tiny.url) if @post.user.avatar? %> | |
submitted <%= time_ago_in_words(@post.created_at) %> ago by | |
<%= @post.user.name %> | |
</small> | |
<p><%= markdown @post.body %></p> |
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
def say_hello | |
print "#{hello}!" | |
end | |
say_hello |
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
def add(a,b) | |
a + " plus " + b | |
end | |
add(1,2) |
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
my_array = [1,2,3] | |
my_array.each do |number| | |
puts "I can count to #{number}" | |
puts "but that is all." |
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
def foo(a, b) | |
a + b + foo | |
end | |
foo("1, 2") |
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
def almost_done(a, b, c) | |
puts "#{a} is almost done with #{b}, #{c}, and #{d}!" | |
end | |
d = "this section of quizzes!" | |
almost_done("breakfast", "lunch", "dinner") |
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
# We're going to write a very simple conversation bot. | |
def get_response(prompt) | |
if prompt.include?("hello") | |
"Hello! How are you?" | |
elsif prompt.include?("bye") | |
"Bye! It was great talking to you!" | |
else | |
"I do not understand what you mean by: \"#{prompt}\"" | |
end |
OlderNewer