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
#!/usr/bin/env ruby | |
# | |
# Adds a border around all the arguments passed to this script. | |
# | |
# Example: | |
# | |
# $ borderify hello you | |
# => 🄷 🄴 🄻 🄻 🄾 🅈 🄾 🅄 | |
LOOKUP_TABLE = { |
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
var express = require('express') | |
var app = express() | |
app.use(express.static('.')) | |
app.listen(3000, function () { | |
console.log('App listening on port 3000!') | |
}) |
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
let webpack = require('webpack') | |
module.exports = { | |
devtool: 'inline-sourcemap', | |
context: __dirname, | |
entry: "./index.js", | |
output: { | |
path: "./js", | |
publicPath: '/js', | |
filename: "bundle.js" |
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
describe Bowling, "#score" do | |
it "returns 0 for all gutter game" do | |
bowling = Bowling.new | |
20.times { bowling.hit(0) } | |
bowling.score.should eq(0) | |
end | |
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
def favorite post | |
favorite = post.favorites.create!(user: current_user) | |
post.user.notify_of favorite if post.user.likes_emails? | |
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
def favorite post | |
post.favorites.create!(user: current_user) | |
if post.user.email_settings.email_favorites? | |
UserMailer.favorite_email('Your post was favorited!', | |
"Good job! Your post was favorited. | |
#{link_to post_path(post), 'Have a look for yourself'}. \ | |
Your friendly social networking team.").deliver | |
end | |
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
def greet user | |
"Hello, %s!" % if user.admin? | |
"sir" | |
else | |
"you" | |
end | |
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
def greet user | |
title = if user.admin? | |
"sir" | |
else | |
"you" | |
end | |
"Hello, #{title}!" | |
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
def comment_on_popularity | |
if post.stars.empty? | |
"Your post is flying under the radar." | |
else | |
if post.stars.count > 100 | |
"Congratulations. Your post is popular!" | |
elsif post.stars.count > 50 | |
"Well done. Your post is trending." | |
else | |
"Doing well but could use a little attention." |
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 comment_on_popularity | |
if !post.stars.empty? | |
if post.stars.count > 100 | |
"Congratulations. Your post is very popular." | |
elsif post.stars.count > 50 | |
"Well done. Your post is trending." | |
else | |
"Your post is doing well but could use a little attention." | |
end | |
else |
NewerOlder