Skip to content

Instantly share code, notes, and snippets.

View maclover7's full-sized avatar

Jon Moss maclover7

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Place Autocomplete</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
</head>
<body>
<input id="city-input" class="controls" type="text"
placeholder="Enter a location">
# Lesson.joins(:contents).where("contents.curriculum_id" = ?", "3280")
SELECT curriculum_id FROM Contents
WHERE curriculum_id IN
(SELECT curriculum_id FROM Contents
GROUP BY curriculum_id HAVING COUNT (curriculum_id) >1)
# Line 80 in config/environments/production.rb
# Original: config.action_mailer.default_url_options = { host: => 'realfootball.herokuapp.com' }
config.action_mailer.default_url_options = { :host => 'realfootball.herokuapp.com' }
Jons-MacBook-Pro-6% ruby jon.rb
/Users/jon/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize': SQLite3::SQLException: no such column: student_assignments.assignment_due_date: SELECT "student_assignments".* FROM "student_assignments" WHERE "student_assignments"."assignment_due_date" = ? (ActiveRecord::StatementInvalid)
from /Users/jon/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
from /Users/jon/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
from /Users/jon/code/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:258:in `block in exec_query'
from /Users/jon/code/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:497:in `block in log'
from /Users/jon/code/rails/activesupport/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /Users/jon/code/rails/activerecord/lib/active_record
SQLite3::SQLException: no such column: student_assignments.assignment_due_date: SELECT COUNT(*) FROM "student_assignments" WHERE "student_assignments"."student_id" = ? AND "student_assignments"."assignment_due_date" = 'Saturday, May 23'
@maclover7
maclover7 / gist:1f4b46d2c6a36555dba7
Created April 9, 2015 16:17
reverse engineer all the things
user[settings_attributes][auto_refresh_comments]
user[settings_attributes][expanded_comment_view]
namespace :claide do
task :namespace do
files = Dir.glob('lib/bundler/vendor/CLAide*/**/*.rb')
sh "sed -i.bak 's/CLAide/Bundler::CLAide/g' #{files.join(' ')}"
sh "rm #{files.join('.bak ')}.bak"
end
task :clean do
files = Dir.glob('lib/bundler/vendor/CLAide*/*', File::FNM_DOTMATCH).reject { |f| %(. .. lib).include? f.split('/').last }
puts files
@maclover7
maclover7 / error
Created January 19, 2015 17:38
Stack Overflow
Failure/Error: put :update, hackathon_id: create(:hackathon), submission_id: @submission, submission: FactoryGirl.attributes_for(:submission), :format => :json, :access_token => @token.token
ActiveRecord::RecordNotFound:
Couldn't find Submission with 'id'=Dolorum ipsa officiis velit et id quo ea.
# ./app/controllers/api/v1/submissions_controller.rb:60:in `set_submission'
# ./spec/controllers/api/v1/submissions_controller_spec.rb:88:in `block (5 levels) in <top (required)>'
# PATCH/PUT /profiles/1
# PATCH/PUT /profiles/1.json
def update
respond_to do |format|
if @profile.update(profile)
format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }
else
format.html { render :edit }
end
end
Failures:
1) ProfilesController PUT #update valid attributes located the requested @profile
Failure/Error: put :update, id: @profile, profile: FactoryGirl.attributes_for(:profile)
NameError:
undefined local variable or method `profile' for #<ProfilesController:0x007fae343cfe08>