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
class Book | |
attr_accessor :title, :author | |
def initialize(title, author) | |
@title = title | |
@author = author | |
end | |
def read | |
puts "I'm reading #{@title} by #{@author}" |
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
class Image | |
attr_accessor :data | |
def initialize(data) | |
@data = data | |
end | |
def blur | |
# Empty array to hold x, y coords with values of "1" | |
to_be_changed = Array.new |
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
function colorEveryOther(str) { | |
var arr = str.split(" "); | |
for (var i = 0; i < arr.length; i++) { | |
if (i % 2 === 0) { | |
arr[i] = "<span>" + arr[i] + "</span>"; | |
} | |
} | |
var newStr = arr.join(" "); | |
return newStr; | |
} |
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
<xsl:template match="your-html-element"> | |
<div class="color-every-other"> | |
<xsl:variable name="content" select="path-to-content"/> | |
<xsl:for-each select="tokenize($content, ' ')"> | |
<xsl:choose> | |
<xsl:when test="position() mod 2 != 0"> | |
<span><xsl:value-of select="concat(., ' ')"/></span> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="concat(., ' ')"/> |
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
# Dropdown search for examples categorized by their device | |
<%= form_tag(examples_path, :method => "get") do %> | |
<%= select("example", "device", Example.all.map{ |e| e.device }.uniq.sort, selected: 'alliteration') %> | |
<%= submit_tag "Go!" %> | |
<% end %> | |
# The home page checks to see if a device has been selected in the dropdown search, and shows examples of that device if so | |
def index |
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
window.onload = function() { | |
cleanTitles(); | |
function cleanTitles() { | |
var arr = document.getElementsByClassName("index-item-title-text"); | |
for (var i = 0; i < arr.length; i++) { | |
var element = arr[i]; | |
element.innerText = stripCategory(element.innerText); | |
} | |
} | |
function stripCategory(str) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Dictionary App</title> | |
<!-- Link to CSS goes below --> | |
</head> | |
<body> |
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
window.onload = function() { | |
// Your JavaScript goes below | |
} |
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
window.onload = function() { | |
// Your JavaScript goes below | |
var submitButton = document.getElementById("submitButton"); | |
var inputBox = document.getElementById("inputBox"); | |
var wordSearched = document.getElementById("wordSearched"); | |
var results = document.getElementById("results"); | |
var results2 = document.getElementById("results2"); | |
} |
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
submitButton.addEventListener("click", function() { | |
// Do stuff! | |
}); |
OlderNewer