Skip to content

Instantly share code, notes, and snippets.

#this is a test for GIST access API#

@andrewfritz86
andrewfritz86 / file1txt
Created August 25, 2014 19:42
the description for this gist
String file contents
@andrewfritz86
andrewfritz86 / file1txt
Created August 25, 2014 19:45
the description for this gist
String file contents
@andrewfritz86
andrewfritz86 / auth_musings.md
Last active August 29, 2015 14:07
Thoughts on Auth in our app

#Authentication, Logging in and Authorization in our app so far

###Authentication

Authentication in our app is fairly straightforward, at this point. In our gemfile, we require the gem 'bcrypt', and in our User model, we include the method has secure password. This tells the gem to look at the users table for the password_digest column that we need for the 'salted' or encoded version of our password.

We ask a user to input a password when they create their account. They also must input a confirmation for their password. Bcrypt looks at the password and password confirmation params, and if they match, it encodes the password into an enormous string of symbols and letters, (this is based off an algorithm, and it is equal to the password originally input). The original password isn't stored anywhere. When a user logs in, Bcrypt checks the database to make sure the encoded version of what the user enters upon login matches what's on the able. If that's the case, they are authenticated and logged in.

@andrewfritz86
andrewfritz86 / rendered_js_gist.md
Last active August 29, 2015 14:07
Using JS templates to dynamically render HTML

First, I am going to take a look at the constructor function that we will use to build StudentView objects. Here is the function

function StudentView(model){
  this.$el = $('<p>');
  this.model = model;
}

We define two attributes on the object from the constructor function. First, we define the element ($el) attribute, and assign it to a jQuery object that will create a new paragraph element for us.

@andrewfritz86
andrewfritz86 / todo_mainjs.md
Created October 23, 2014 00:16
Todo app main js explanation

#main.js

Hoo-boy, there aren't enough gifs for this one.

var todoApp       = {};
todoApp.taskNum   = 0;
todoApp.taskViews = {};
@andrewfritz86
andrewfritz86 / todo_taskjs.md
Created October 23, 2014 00:17
Todo app task.js explanation

#task.js

Here we are building the model objects for tasks, which can talk to the TaskView objects, but not directly to the DOM. They talk to the database for us.

function Task(data) {
  console.log('model created with data:', data);
  this.id          = data.id;
  this.completed   = data.completed;
 this.description = data.description;
@andrewfritz86
andrewfritz86 / todo_taskviewjs.md
Created October 23, 2014 00:18
Todo app taskview.js explanation

#task_view.js

function TaskView(model){
  console.log('view created with model:', model);
  this.$el   = $("<li>");
  this.model = model;
  }

This is our constructor function for TaskView objects. We can pass it a model as a parameter. The console will log the details of that model for us.

@andrewfritz86
andrewfritz86 / heroku_rails.md
Created February 17, 2015 15:30
Rails and Heroku
@andrewfritz86
andrewfritz86 / lemonknopemac
Last active August 29, 2015 14:16
install script for lemon/knope
#!/usr/bin/env bash
echo -e "Welcome to WDI! This script will install a few programs that we'll be using in class. You may be prompted to enter your password. You won't see anything input when you type, but just press enter once you've entered your password"
# Install Homebrew
# piping echo to simulate hitting return in the brew install script
echo | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"