Skip to content

Instantly share code, notes, and snippets.

View sbswigart's full-sized avatar

Steven Swigart sbswigart

View GitHub Profile
@sbswigart
sbswigart / form-validator.js
Created September 5, 2013 18:43 — forked from ksolo/form-validator.js
Form Validation
// shorthand for $(document).ready();
$(function(){
//Your code...
});
/* 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.
Choose a new pair for each. Add your names to the section you complete.
*/
@sbswigart
sbswigart / index.html
Created September 2, 2013 01:55 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!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>
class Vehicle
attr_reader :color, :status, :wheels, :needs_gas_prob
def initialize(args={})
@color = args[:color] || "white"
@status = args[:status] || :stopped
@wheels = args[:wheels] || 4
@needs_gas_prob = args[:needs_gas_prob] || [true, false]
end
@sbswigart
sbswigart / gist:5882788
Last active December 19, 2015 02:28
Recursion practice for DBC.
def flatten(array)
new_array = []
array.each_index do |x|
if array[x].is_a?(Array)
array[x].each do |y|
if y.is_a?(Array)
new_array += flatten(y)
else
new_array << y
@sbswigart
sbswigart / gist:5080034
Created March 4, 2013 04:52
trying to use bundle install this is the output with "bundle install --verbose"
Fetching from: https://rubygems.org/api/v1/dependencies
Fetching source index from https://rubygems.org/
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint (https://rubygems.org/specs.4.8.gz)
/Users/SS/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:331:in `rescue in connection_for'
/Users/SS/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:328:in `connection_for'
/Users/SS/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:413:in `request'
/Users/SS/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:205:in `fetch_http'
/Users/SS/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:238:in `fetch_path'
/Users/SS/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:269:in `load_specs'
/Users/SS/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:231:in
@sbswigart
sbswigart / gist:5079990
Created March 4, 2013 04:38
Trying to follow this tutorial on Rails http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-bundler When I use "bundle install" I get this output Fetching source index from https://rubygems.org/ Could not fetch specs from https://rubygems.org/ The gemfile is posted below from the tutorial
source 'https://rubygems.org'
gem 'rails', '3.2.12'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required