Skip to content

Instantly share code, notes, and snippets.

View kajatiger's full-sized avatar
👩‍💻
hacking the patriarchy

kaja kajatiger

👩‍💻
hacking the patriarchy
View GitHub Profile
@kajatiger
kajatiger / cat.rb
Created October 20, 2016 12:01
creating a class
class Cat
attr_reader :color, :breed #:name
attr_accessor :name #instead of mentioning the attribute both in reader and writer, we can do both in the same time with accessor
#attr_writer :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
@kajatiger
kajatiger / pet.rb
Created October 20, 2016 13:03
inheritance class
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
@kajatiger
kajatiger / ruby_game.rb
Created October 31, 2016 16:16
play rock, scissors, paper against my code
puts "please type rock, scissors or paper"
player = gets.chomp
rand(1..3)
if rand(1..3) == 1
computer = "rock"
elsif rand(1..3) == 2
@kajatiger
kajatiger / products_controller.rb
Created November 11, 2016 15:52
not sure if this is enough to separate development search terms from production search terms
class ProductsController < ApplicationController
before_action :set_product, only: [:show, :edit, :update, :destroy]
# GET /products
# GET /products.json
if RAILS_ENV == "development"
def index
if params[:q]
search_term = params[:q]
@products = Product.where("name LIKE ?", "%#{search_term}%")

Keybase proof I hereby claim: * I am kajatiger on github. * I am kaja (https://keybase.io/kaja) on keybase. * I have a public key ASAO66UqrqbLKnDk80464wvNiZKKoA9xhrdv9goUn8G-ego To claim this, I am signing this object: ```json { "body": { "key": { "eldest_kid": "01200eeba52aaea6cb2a70e4f34e3ae30bcd89928aa00f7186b76ff60a149fc1be7a0a", "host": "keybase.io", "kid": "01200eeba52aaea6cb2a70e4f34e3ae30bcd89928aa00f7186b76ff60a149fc1be7a0a", "uid": "99763235b36a8ca5275181f7428b8819", "username": "kaja" }, "merkle_root": { "ctime": 1511449892, "hash": "5fc621ff34dd2ee699a7719b34bbec8c6e4db81b085173400d4529e76f581a0d79e0ff127f35fde102b12fa076894bc8ef1fe16f105bf543550521c39125b5c6", "hash_meta": "b49767d6aa00d09830c2a0457adb72ad58d487d5f6beaa4069a1558954f33183", "seqno": 1739245 }, "service": { "name": "github", "username": "kajatiger" }, "type": "web_service_binding", "version": 1 }, "client": { "n

Keybase proof

I hereby claim:

  • I am kajatiger on github.
  • I am kaja (https://keybase.io/kaja) on keybase.
  • I have a public key ASAO66UqrqbLKnDk80464wvNiZKKoA9xhrdv9goUn8G-ego

To claim this, I am signing this object: