Skip to content

Instantly share code, notes, and snippets.

View chug2k's full-sized avatar

Charles Lee chug2k

  • San Francisco, CA
View GitHub Profile
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://'",
@chug2k
chug2k / gist:6520211
Last active December 22, 2015 19:29
for zaidi
# 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
@chug2k
chug2k / gist:6520262
Last active December 22, 2015 19:29
method practice for zaidi
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.
@chug2k
chug2k / gist:6859533
Created October 6, 2013 21:49
temp for mitch y
<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>
def say_hello
print "#{hello}!"
end
say_hello
def add(a,b)
a + " plus " + b
end
add(1,2)
my_array = [1,2,3]
my_array.each do |number|
puts "I can count to #{number}"
puts "but that is all."
def foo(a, b)
a + b + foo
end
foo("1, 2")
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")
@chug2k
chug2k / ifstatements.rb
Created October 9, 2013 01:37
Simple conversation bot
# 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