Skip to content

Instantly share code, notes, and snippets.

(function(angular) {
'use strict';
var app = angular.module('MyApp', []);
app.factory('GeolocationSvc', [
'$q', '$window',
function($q, $window) {
return function() {
var deferred = $q.defer();
vid = document.getElementsByClassName("video-stream html5-main-video")[0];
vid.playbackRate = 3.0;
require 'oauth2'
require 'net/http'
require 'uri'
API_KEY = 'XXXXXXXXX' #Your app's API key
API_SECRET = 'XXXXXXXXXXXXX' #Your app's API secret
REDIRECT_URI = 'http://localhost:3000/accept' #Redirect users after authentication to this path
#Instantiate your OAuth2 client object
def client
function GetCommentsWithOAuth(){
viewModel.comments([]);
$.ajax({ url: "/services/comments/oauth",
accepts: "application/json",
cache: false,
statusCode: {
200: function(data){
viewModel.comments(data);
},

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

Chapter 2

Hours in a year

puts 365 * 24

Minutes in a decade

puts 365 * 10 * 24 * 60 

Your age in seconds

puts 60 * 60 * 24 * 365 * 26 

Our dear author's age

1025000000 / (60 * 60 * 24 * 365)

Intro to Prototypes

JS Data Structures

Outline

  • Objects in Javascript?
    • object literals
    • properties

Angular Workshop

An Brief Introduction

Objective
To identify the basic compenents of a Angular application and integrate them together in a manner that creates a canonical example for one to further develop or rexamine afterward.

Outline

Intro to Rails

A Routing First Overview

Objective
We should grasp the concepts related to routing requests, connecting them to controllers, present a view, and gain a naive understanding of the flow of a request and response.

Related Materials/Information