This file contains hidden or 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
require 'active_support/concern' | |
require 'active_support/callbacks' | |
module ActiveSupport | |
module Testing | |
module SetupAndTeardown | |
module ForClassicTestUnit | |
# This redefinition is unfortunate but test/unit shows us no alternative. | |
# Doubly unfortunate: hax to support Mocha's hax. | |
def run(result) |
This file contains hidden or 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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
This file contains hidden or 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
RSpec.configure do |config| | |
include Rails.application.routes.url_helpers | |
# ... | |
end | |
This file contains hidden or 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 choose | |
puts "Do you like programming? Yes, no, or maybe please." | |
choice = gets.chomp | |
case choice.downcase | |
when "yes" | |
puts "That's great!" | |
when "no" | |
puts "That's too bad!" | |
when "maybe" | |
puts "Glad you are giving it a chance!" |
This file contains hidden or 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 fav_foods | |
food_array = [] | |
3.times do | |
puts "Name a favorite food" | |
food_array << gets.chomp | |
end | |
p food_array | |
puts "Your favorite foods are #{food_array.join(", ")}" | |
food_array.each do |food| # do something to each element in food_array; that element is to be referred to as food | |
puts "I like #{food} too!" # the thing we are doing |
This file contains hidden or 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
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Phil Jedar PortFolio</title> | |
<!-- CSS -- > | |
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> |
This file contains hidden or 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 $char_count = $("#char-count"); | |
$char_count.html(charCount); | |
if (charCount > 50) { | |
$char_count.css("color", "red"); | |
} | |
else { | |
$char_count.css("color", "#fff"); | |
} |
This file contains hidden or 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
<head> | |
<title>Nameofapp</title> | |
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> | |
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> | |
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> | |
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script> |
This file contains hidden or 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
require 'rest-client' | |
user_id = 5 | |
secret_key = 'secret key of user with id 5' | |
def calculate_canonical_string(content_type, content_md5, path, timestamp) | |
[ content_type, | |
content_md5, | |
path, | |
timestamp |
This file contains hidden or 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
require 'rest-client' | |
user_id = 5 | |
secret_key = 'secret key of user with id 5' | |
tutor_id = 105 | |
timestamp = Time.now.utc.httpdate # Example: "Mon, 03 Aug 2015 20:15:56 GMT" | |
def calculate_canonical_string(content_type, content_md5, path, timestamp) |
OlderNewer