Skip to content

Instantly share code, notes, and snippets.

View xander-miller's full-sized avatar

Xander Miller xander-miller

View GitHub Profile
@xander-miller
xander-miller / simple_class.rb
Created March 1, 2014 14:52
Sheldon Exercise
class Book
def title_and_author(title, author)
#some stuff
end
def description
#some other stuff
end
end
@xander-miller
xander-miller / array_extension.rb
Created March 2, 2014 16:13
Sheldon's exercise
class Array
def sum
sum = 0
self.each do |item|
#some code
end
sum
end
def add_index
@xander-miller
xander-miller / application.rb
Created March 3, 2014 22:21
What Application.rb should look like.
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user
# if a member, they can manage their own posts
# (or create new ones)
if user.role? :member
can :manage, Wiki, private: true, Wiki.collaborators do |collaborator|
require 'faker'
# Create 15 Topics
topics = []
15.times do
topics << Topic.create(
name: Faker::Lorem.sentence,
description: Faker::Lorem.paragraph
)
end
@xander-miller
xander-miller / index.html
Last active August 29, 2015 13:57
Anne's project
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
require 'faker'
# Create 15 topics
topics =[]
15.times do
topics << Topic.create(
name: Faker::Lorem.sentence,
description: Faker::Lorem.paragraph
)
end
require 'faker'
# Create 15 topics
topics =[]
15.times do
topics << Topic.create(
name: Faker::Lorem.sentence,
description: Faker::Lorem.paragraph
)
end
require 'faker'
# Create 15 topics
topics = []
15.times do
topics << Topic.create(
name: Faker::Lorem.words(rand(1..10)).join(" "),
description: Faker::Lorem.paragraph(rand(1..4))
)
end
require 'faker'
topics = []
15.times do
topics << Topic.create(
name: Faker::Lorem.words(rand(1..10)).join(" "),
description: Faker::Lorem.paragraph(rand(1..4))
)
end