Skip to content

Instantly share code, notes, and snippets.

# frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :first_name, null: false
t.string :last_name, null: false
t.string :user_name, null: false
t.string :email, null: false, default: ""
@CodePint
CodePint / comment_migration.rb
Created May 11, 2018 14:31
gist_send_route01
class CreateComments < ActiveRecord::Migration[5.1]
def change
create_table :comments do |t|
t.references :climbs
t.references :users
t.text :text
t.timestamps
end
end
end
# frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :first_name, null: false
t.string :last_name, null: false
t.string :user_name, null: false
t.string :email, null: false, default: ""
class CreateGyms < ActiveRecord::Migration[5.1]
def change
create_table :gyms do |t|
t.references :users
t.references :routes
t.string :gym_name, null: false
t.text :about
t.string :address
t.string :email
t.timestamps
Rails.application.routes.draw do
devise_for :users
resources :users do
resources :images
resources :reviews
end
resources :memberships, only: [:new, :create]
@CodePint
CodePint / binary_tree.rb
Created February 8, 2018 15:56
binary tree and nodes
class Node
attr_accessor :data, :left, :right
def initialize(data)
@data = data
end
include Comparable
def <=>(node)
##Turn based ruby game
=begin
GOAL
Write a simple game that allows the user and the computer to take turns selecting moves to use against each other.
Both the computer and the player should start out at the same amount of health (such as 100),
and should be able to choose between the three moves:
The first move should do moderate damage and has a small range (such as 18-25).
The second move should have a large range of damage
and can deal high or low damage (such as 10-35).
##Turn based ruby game
=begin
GOAL
Write a simple game that allows the user and the computer to take turns selecting moves to use against each other.
Both the computer and the player should start out at the same amount of health (such as 100),
and should be able to choose between the three moves:
The first move should do moderate damage and has a small range (such as 18-25).
The second move should have a large range of damage
and can deal high or low damage (such as 10-35).
##Turn based ruby game
=begin
GOAL
Write a simple game that allows the user and the computer to take turns selecting moves to use against each other.
Both the computer and the player should start out at the same amount of health (such as 100),
and should be able to choose between the three moves:
The first move should do moderate damage and has a small range (such as 18-25).
@CodePint
CodePint / rubytest222.rb
Created December 11, 2017 21:40
rubystycheck
##random number
=begin
Goal
By using the random module, python can do things like pseudo-random number generation.
So in this program, allow the user to input the amount of sides on a dice and how many times it should be rolled.
From there, your program should simulate dice rolls and keep track of how many times each number comes up (this does not have to be displayed).
After that, print out how many times each number came up.