Skip to content

Instantly share code, notes, and snippets.

@dennisle
dennisle / OVLjmz.markdown
Last active August 29, 2015 14:19
OVLjmz
@dennisle
dennisle / debug
Last active August 29, 2015 14:18
debug
Runtime Errow in Post#show
Extracted source (around line #6)
def title
raise
end
end
Routing Error (same)
No route matches [GET] "/posts/1"
It gave me a Routes in priority from top to bottom
@dennisle
dennisle / gem
Last active August 29, 2015 14:18
Gemfile_tree
Gem would not bundle....
source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'turbolinks'
@dennisle
dennisle / debugging
Last active August 29, 2015 14:18
Debugging
After inputing the ther erros in my app, these are the air messesges I recived.
RuntimeError in Posts#index
Showing /Users/dennisle/code/bloccit/app/views/posts/index.html.erb where line #6 raised:
Extracted source (around line #5):
3
4
5
6
@dennisle
dennisle / class StackOver
Created March 31, 2015 06:11
Intro_Class_Stack_Over
bloccit git:(master) irb
2.2.0 :001 > class ArgumentEchoer
2.2.0 :002?> def echo_argument(argument)
2.2.0 :003?> p "You just inputted a value: " + argument
2.2.0 :004?> end
2.2.0 :005?> end
=> :echo_argument
2.2.0 :006 > instance = ArgumentEchoer.new
=> #<ArgumentEchoer:0x007fa7b98cf588>
2.2.0 :007 > instance.echo_argument(5)
@dennisle
dennisle / rake
Created March 30, 2015 20:16
Rake (crud)
bloccit git:(master) rake db:migrate
== 20150330163252 CreateAdvertisements: migrating =============================
-- create_table(:advertisements)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "advertisements" already exists: CREATE TABLE "advertisements" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar, "copy" text, "price" integer, "created_at" datetime, "updated_at" datetime) /Users/dennisle/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/Users/dennisle/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/Users/dennisle/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/Users/dennisle/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
@dennisle
dennisle / models
Last active August 29, 2015 14:17
Models
(Creat a blog model with a title that is a string)
class Blog < ActiveRecord::Migration
def change
create_table : do |t|
t.string :title
end
end
end
----------------------------------------------------
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
@dennisle
dennisle / lock
Created March 23, 2015 19:01
lock
#can||
#can test a, b , c and and d
#given if(a == 5 || a == 3 a == 1) &&
=begin spec
describe "lock" do
it "should return unlocked for 3258" do
expect( lock(3, 2, 5, 8) ).to eq('unlocked')
end
it "should return locked for 1111" do
expect( lock(1, 1, 1, 1) ).to eq('locked')