Skip to content

Instantly share code, notes, and snippets.

View theonlyrao's full-sized avatar

Ashwin Rao theonlyrao

View GitHub Profile
@theonlyrao
theonlyrao / translate_method.rb
Created February 27, 2016 19:52
before using objects...
def translate(english_array)
@braille_arrays = []
english_array.each do |word|
@characters = word.chars
end
binding.pry
if @characters[0].to_i.to_s == @characters[0] # checking to see if number
@braille_arrays << @etb_hash["#"]
@characters.each do |char|
@braille_arrays << @etb_hash[char]
@theonlyrao
theonlyrao / translate_method.rb
Created February 27, 2016 19:58
after using objects
class Write
...
def translate(english_array)
english_array.each do |element|
if element.to_i.to_s == element
@number = Number.new(element)
push_one(@number.number1)
push_two(@number.number2)
@theonlyrao
theonlyrao / black_thursday_dtr.md
Created March 5, 2016 19:09
DTR for Black Thursday project

DTR Memo

Project: Black Thursday

Group Members: Ashwin Rao, Jennifer Soden (did not complete project)

Goals and Expectations

  • We both would like passing scores
  • Jenny expects communication — if someone says something, don’t just acknowledge, actually say something as to why it should or shouldn’t be done that way

Schedule/Availability

@theonlyrao
theonlyrao / ashwin_rao_lighting_talk_outline.md
Last active March 22, 2016 17:44
Developing for Ecommerce Marketing

Purpose: To give Turing students and introduction to basic ecommerce principles so that they can develop back end systems that provide more business value.

Each number below represents a slide. The contents of the slide would be the topic and any necessary definitions. I would primarily use discussion to explain the concepts in detail.

Outline:

1) My background: started ecommerce company in 2012 and have learned from mistakes in all these areas

2) Basic rule of ecommerce: value of a customer to the business > cost of acquiring that customer

Introduction to Sinatra

1. What is the purpose of the server file (routing)?

The server file accepts, parses, and controls the sending of the response. It will contain get or post etc. verb blocks based on the client's chosen path and then contain instructions for the rest of the web application to follow in collecting information from a database and then rendering that information in the context of the user's request.

2. How do you pass variables into the views?

  • Make the variable a local variable, var. Then pass the variable as an argument into the view as a hash.
@theonlyrao
theonlyrao / chart_of_actions.md
Created March 22, 2016 20:22
RESTful design for task manager
What users want CRUD Action (url) Method/Verb Data Prep Redirect/Render View
See all tasks read '/tasks' GET @tasks = task_manager.all render :index
See one task read '/tasks/:id' GET @task = task_manager.find(id) render :show
See form to input task info create 'tasks/new' GET none render :new
Click Submit and save task create '/tasks' POST task_manager. create(params[:task]) redirect '/tasks/:id'
See form to update task info update '/tasks/:id/edit' GET @task = task_manager.find(id) render :edit
Click submit and save updated info update 'tasks/:id' PUT/PATCH task_manager.update(params[tasks].id) redirect '/tasks/:id'
delete a task delete 'tasks/:id/delete' DELETE task_manager.delete(id) redirect '/tasks'
@theonlyrao
theonlyrao / cfu_crud_in_sinatra.markdown
Last active March 23, 2016 04:22 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding

Define CRUD.

  • Create - tells the server to make a new instance
  • Read - asks the server for information
  • Update - tells the server to change something in an existing instance
  • Delete - tells the server to remove something

These four functions are necessary for a complete web application.

There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for.

## Models, Databases, Relationships in Rails
#### What is the difference between a primary key and a foreign key? Where would we find a primary key? What would it be called by default? Where would we find a foreign key? What is the naming convention for a foreign key?
Primary key is a unique identifier in Table. It can exist as a foreign key in AnotherTable or other tables with which it has a relationship. "id" - default name. "table_id" in AnotherTable.
#### Write down one example of:
* a `one-to-one `relationship.
(in the contemporary West), one husband has one wife
@theonlyrao
theonlyrao / github_shortcuts.txt
Created April 14, 2016 15:25
useful github keyboard shortcuts
? => lists keyboard shortcuts available for the page
s => focus on the search bar (site wide)
g + c => go to repo home (in repositories)
g + p => go to open pull requests (in repositories)
t => activates file finder (while browsing source code)
l => jump to a line in code (while browsing source code)
w => switch to view same file in a different branch (while browsing source code)
@theonlyrao
theonlyrao / asset_pipeline_challenge.md
Last active April 20, 2016 15:46
asset pipleline challenge answers

Scavenger Hunt

  1. To concatenate files is to take the contents of several files and to insert them one after another into a different file. When rails concatenates files using sprokets, it create a unique "fingerprint" to indicate the beginning of a new file.

  2. Precompilation is the process of re-coding a file into a high level language for faster processing by a client.

  3. Minification is the process of removing whitespace and comments from an asset.

  4. I dont know. I'm not convinced they are the same file.

  5. Manifests are files that tell sprokets what to compile into its css file for the application. The manifests in catch em all are in app/assets/javascripts/application.js and app/assets/stylesheets/application.css.sass