Skip to content

Instantly share code, notes, and snippets.

View theonlyrao's full-sized avatar

Ashwin Rao theonlyrao

View GitHub Profile

Testing Homework - Rails/JS

  • Your experience implementing

I tried both unit using Jasmine-Rails and feature testing using Capybara.

  • Were you successful?

I was not successful in implementing Jasmine-Rails, but I was successful impelemting feature testing using Capybara. The feature testing is nice in that it lets me confirm what a user is setting, but it would have been good to have spies set up through Jasmine-Rails so that I can confirm that the ajax calls are actually hitting the correct route with the correct data.

  • What is ES6?

"ES6", or ECMAScript 6, is the latest version of JavaScript. It brings multiple updates to JS.

  • What is Transpilation and how does it relate to ES6?

Transpilation is a form of compliation. Compiling takes a language and turns it into another language; transpiling takes a language and turns it into a language with the same level of abstraction.

  • Looking at the ES6 Features link below, discuss one update from ES5 and if it seems useful/superfluous.
@theonlyrao
theonlyrao / js_exercisms_ashwin.md
Last active June 22, 2016 18:40
JS exercism report

##Hello World My code: here

  • Responder #1 (here) - This response is an implementation that I was wondering how to do because it handles a nil value for input as a way of defaulting to "World" instead of a name.
  • Responder #2 (here) - This response is essentially the same as my implementation, but uses a ternary operator for the if/else that I broke out. I find it much harder to read as a ternary.
  • Responder #3 (here) - This response also uses a ternary, but within the return block so that if there is an input it gets used, but if there isn't then "World" is returned. I like this better than #2 but still don't like it very much because it seems weird to be evaluating the input within the return block instead of first determining what has been
@theonlyrao
theonlyrao / 20160425_blog_empathy.md
Last active April 26, 2016 18:10
The importance of empathy for users

I want to be a back-end developer. I know it is cooler to be a "full-stack" developer, but if I never have to write CSS again it will be too soon.

I did not expect that I would feel so differently about front-end and back-end work. With an undergrad degree in Fine Arts and an interest in good design, I might even have expected to be more interested in front-end work. However, after having gotten my feet wet over the past three months at Turing, it's pretty clear that I get excited when I get to think about the structure of databases and their interactions. Maybe even configuring servers, although I haven't done much of that yet.

However, while working on a personal project I learned an important lesson about not ignorning the front-end. My personal project is something I've been exctied about ever since I read about it in HBR - building a performance review app that Deloitte developed in order to get actionable data about employees instead of useless information about managers.

I launched a first pass of t

@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

@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)
## 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 / 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.

@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'

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.