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 palindrome?(str) | |
letters = str.downcase.scan(/\w/) | |
letters == x.reverse | |
end | |
def count_words(str) | |
word_count = Hash.new(0) | |
str.downcase.scan(/\w+/).each do |word| | |
word_count[word] += 1 | |
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
# Bank Teller Project | |
def add_account(name, password, accounts) | |
accounts = {'name'=>name,'password'=>password,'balance'=>0} | |
return accounts | |
end | |
def get_balance(accounts) | |
return accounts['balance'] | |
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
class Board < Array | |
def initialize(board_string) | |
super | |
end | |
def boxes | |
triplets = self.flatten.each_slice(3).to_a | |
temp = triplets.each_slice(3).to_a | |
almost_there = temp.transpose |
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
require 'nokogiri' | |
require_relative 'utils' | |
require 'open-uri' | |
class Scraper | |
def initialize(path) | |
@doc = Nokogiri::HTML(File.open(path)) | |
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
/* Here is your chance to take over Socrates! | |
Spend 10 minutes on each of the following hacks to the Socrates website. | |
Enter them in the console to make sure it works and then save | |
your results here. | |
/*1. Use basic selectors (id, class, element) to choose an element on the page. | |
Use the .css() method to alter at least two CSS properties of this element. */ | |
$(".span9").css("color", "pink") |
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> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
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
//------------------------------------------------------------------------------------------------------------------ | |
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here. | |
//------------------------------------------------------------------------------------------------------------------ | |
function Animal(name, legs) { | |
this.name = name; | |
this.legs = legs; | |
}; |
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
$(document).ready(function(){ | |
$(document).on("submit","form", function(event){ | |
event.preventDefault(); | |
var email = $("form").find("#email").val(); | |
var password = $("form").find("#password").val(); | |
var errors = checkEmailErrors(email).concat(checkPasswordErrors(password)); | |
if (errors.length === 0){ |
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
// Shorthand for $(document).ready(); | |
$(function(){ | |
// Your code goes here... | |
}); |
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
" Based on | |
runtime colors/ir_black.vim | |
let g:colors_name = "grb256" | |
hi pythonSpaceError ctermbg=red guibg=red | |
hi Comment ctermfg=darkgray | |
hi StatusLine ctermbg=darkgrey ctermfg=white |
OlderNewer