Skip to content

Instantly share code, notes, and snippets.

@lukyans
Last active September 4, 2020 04:41
Show Gist options
  • Save lukyans/4dfd2f14e06d139ac54807fc84dc5a2d to your computer and use it in GitHub Desktop.
Save lukyans/4dfd2f14e06d139ac54807fc84dc5a2d to your computer and use it in GitHub Desktop.

Answer 1

MVC stands for M - Model V - View C - Controller

Models are responsible for handling data storage and the business logic. View is a visual representation of its model Controllers act as the bridge between the Models and the Views.

Answer 2

company = Company.new({name: 'Pied Piper'}) - new object is instantiated with a hash attribute but not yet saved company.save - instantiated object is saved

Answer 3

this.bar is not a function

Answer 4

function duplicates(array) {
  var hash = {};
  var result = [];

  array.forEach(function (num) {
    if(!hash[num])
        hash[num] = 0;
      hash[num] += 1;
  })

  for (var i in hash) {
     if(hash[i] >= 2) {
         result.push(i);
     }
  }
    return result;
}

console.log(duplicates([1, 2, 3, 3, 4, 5, 5, 6]));

Answer 5

One can use index to speed up querying so that you can get rows or sort rows faster. 
Example:
CREATE INDEX IX_company 
ON FundingRound (company_id, funding_in_usd)
INCLUDE (any columns needed for the query)

ActiveRecord

class Company < ActiveRecord::Base
  has_many :funding_rounds
end

class FundingRound < ActiveRecord::Base
  belongs_to :company
end

company = Company.find_by(id: id)
company.funding_rounds

SQL

SELECT FundingRounds.FundingRoundID, Companies.name, FundingRounds.FundingInUsd
FROM FundingRounds
INNER JOIN Companies ON FundingRounds.CompanyID=Companies.CompanyID;

Answer 6

id = params(:id)

conn = Faraday.new(url: "/funding_rounds/") do |faraday|
    faraday.use Faraday::Response::RaiseError
    faraday.adapter Faraday.default_adapter
end

response = conn.get("/#{id}")
//@funding_round = JSON.parse(response)

Answer 8

The video of the project is attched with the email

Answer 9

I am originally from Ukraine. I completed my bachelor's degree in management of foreign economic affairs. At the age of 19, I moved to the United states in pursuit of the American dream. I had limited choice of employment in the United States. I thought of myself as an entrepreneur with a passion to benefit society. I started a few companies including SDT-tax, to assist with tax returns for international students and another to assist small businesses connect with programmers to build an online presence. However, again and again, I found myself wishing that I could pursue a degree in programming. This came to fruition when I was admitted to Turing School of Software and Design. I am inspired by the ability to solve engineering problems and build solutions for businesses, so that they can realize their full potential.

I am exited to join KITE as a software engineer because I believe I can bring my background in economics end expertise in engineering to build full stack web applications from the ground up, iterating on technologies and ideas to delight users, thinking creatively about solving problems and use code to help companies empower people to do work they love.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment