Skip to content

Instantly share code, notes, and snippets.

@ckib16
ckib16 / mutating_arguments.rb
Last active July 7, 2017 21:22
Mutating arguments - clarifications from written test.
# From LaunchSchool written test 2017-07-07
def shout(string)
string + "!!!" # => "hello world!!!" # Just an operation, not a method on `string`. Silimar to `1 + 1`. Argument `string` stays coupled to `sentence`
string.upcase! # => "HELLO WORLD" # Mutates the caller
end # => :shout
sentence = "hello world" # => "hello world"
shout(sentence) # => "HELLO WORLD"
require 'pry'
VALID_CHOICES = %w(rock paper scissors lizard spock)
total_wins = 0
def prompt(message)
puts "=> #{message}"
end
def autocomplete_player_choice(choice)
require 'pry'
VALID_CHOICES = %w(rock paper scissors lizard spock)
total_wins = 0
def prompt(message)
puts "=> #{message}"
end
def autocomplete_player_choice(choice)
@ckib16
ckib16 / Terminal
Created December 7, 2015 16:36
Rspec output - pilot roster
[11:17]~/wdi/projects/pilot_roster > rspec
ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
Location
(0.2ms) BEGIN
(0.2ms) ROLLBACK
has a valid factory
(0.1ms) BEGIN
(0.2ms) ROLLBACK
is invalid without a base name
@ckib16
ckib16 / Heroku Logs - db:seed error
Created November 17, 2015 20:21
Heroku logs fro db:seed error
2015-11-17T19:40:50.495487+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by ckib16@gmail.com
2015-11-17T19:40:52.497869+00:00 heroku[run.5568]: Awaiting client
2015-11-17T19:40:52.520272+00:00 heroku[run.5568]: Starting process with command `bundle exec rake db:migrate`
2015-11-17T19:40:52.901382+00:00 heroku[run.5568]: State changed from starting to up
2015-11-17T19:40:56.498819+00:00 heroku[run.5568]: Process exited with status 0
2015-11-17T19:40:56.519428+00:00 heroku[run.5568]: State changed from up to complete
2015-11-17T19:41:04.635802+00:00 heroku[api]: Starting process with command `bundle exec rake db:seed_data` by ckib16@gmail.com
2015-11-17T19:41:07.326003+00:00 heroku[run.4634]: Awaiting client
2015-11-17T19:41:07.372270+00:00 heroku[run.4634]: Starting process with command `bundle exec rake db:seed_data`
2015-11-17T19:41:07.783336+00:00 heroku[run.4634]: State changed from starting to up
@ckib16
ckib16 / Bash
Created November 17, 2015 20:18
Heroku db:seed error
[14:53]~/wdi/projects/pilot_tracker > heroku run rake db:seed
Running rake db:seed on pilot-tracker... up, run.6160
ActiveRecord::SchemaMigration Load (2.9ms) SELECT "schema_migrations".* FROM "schema_migrations"
Location Load (3.3ms) SELECT "locations".* FROM "locations"
rake aborted!
ActiveRecord::UnknownAttributeError: unknown attribute 'emblem_url' for Location.
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/attribute_assignment.rb:59:in `rescue in _assign_attribute'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/attribute_assignment.rb:35:in `each'
@ckib16
ckib16 / kibble_resume.html
Created October 14, 2015 01:31
My resume for Homework #1
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chris Kibble - Resume</title>
</head>
<body>
<h1>Chris Kibble</h1>
<h2>Summary</h2>
<p>
Experienced Air Force officer with proven project management, web development, and analytical skills looking to help solve national-level technology problems. Demonstrated success in leading teams that bridged the gap between technical competence and business results. Award-winning instructor adept at learning and communicating highly detailed concepts to all skill levels. Motivated to work with other dedicated and driven professionals. Desired outcome – technical project management position on a USDS national security team. Clearance: DOD Top Secret/SCI Available: Oct 2015 Location: Can relocate to any major metro area.
@ckib16
ckib16 / PG error in Heroku
Created June 27, 2015 20:49
PG error in Heroku for RegisteredApplications#show
Jun 27 13:39:00 quickmetrics app/web.1: Started GET "/registered_applications/1" for 96.255.46.237 at 2015-06-27 20:39:00 +0000
Jun 27 13:39:00 quickmetrics app/web.1: Parameters: {"id"=>"1"}
Jun 27 13:39:00 quickmetrics app/web.1: CACHE (0.0ms) SELECT "registered_applications".* FROM "registered_applications" WHERE "registered_applications"."id" = $1 LIMIT 1 [["id", "1"]]
Jun 27 13:39:00 quickmetrics app/web.1: ActiveRecord::StatementInvalid (PG::GroupingError: ERROR: column "events.created_at" must appear in the GROUP BY clause or be used in an aggregate function
Jun 27 13:39:00 quickmetrics app/web.1: LINE 1: ...ation_id" = $1 GROUP BY "events"."name" ORDER BY created_at...
Jun 27 13:39:00 quickmetrics app/web.1: ^
Jun 27 13:39:00 quickmetrics app/web.1: : SELECT COUNT(*) AS count_all, name AS name FROM "events" WHERE "events"."registered_application_id" = $1 GROUP BY "events"."name" ORDER BY created_at DESC):
Jun 27 13:39
@ckib16
ckib16 / terminal output
Created June 3, 2015 22:02
Terminal output from the curl command for Blocmetrics API
Chris@MBAir:~/coding/bloc/blocmetrics$ curl -v -H "Accept: application/json" -H "Origin: http://miller.biz/matilde" -H "Content-Type: application/json" -X POST -d '{"event_name":"foobar"}' http://localhost:3000/api/events
* Hostname was NOT found in DNS cache
* Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> POST /api/events HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:3000
> Accept: application/json
> Origin: http://miller.biz/matilde
> Content-Type: application/json
@ckib16
ckib16 / events_controller.rb
Created June 3, 2015 21:58
My API events controller
class API::EventsController < ApplicationController
# Skip CSRF protection in development
skip_before_action :verify_authenticity_token
def create
registered_application = RegisteredApplication.find_by(url: request.env['HTTP_ORIGIN'])
if registered_application = nil
render json: "Unregistered application", status: :unprocessable_entity
end