Skip to content

Instantly share code, notes, and snippets.

View unicodeveloper's full-sized avatar
🔥
Developing Platforms

Prosper Otemuyiwa unicodeveloper

🔥
Developing Platforms
View GitHub Profile
@unicodeveloper
unicodeveloper / app.js
Created September 12, 2016 16:14
Cloudinary Blog Post - Part 1
var app = angular
.module('yourtube', [
'ngCookies',
'ngRoute',
'ngStorage',
'ngMessages',
'angularMoment',
'angular-loading-bar',
'ui.bootstrap',
'appRoutes',
@unicodeveloper
unicodeveloper / app-routes.js
Created September 12, 2016 16:16
Cloudinary Blog Post - part 1
var appRoutes = angular.module('appRoutes', []);
appRoutes.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){
$routeProvider
.when('/', {
templateUrl: './views/pages/home.client.view.html'
})
.when('/auth/signup', {
templateUrl: './views/account/create-user.client.view.html',
controller: 'AuthController',
@unicodeveloper
unicodeveloper / home.client.view.html
Created September 12, 2016 16:18
Cloudinary Blog Post - Part 1
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">Recommended</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-4">
<h5>PHP Programming</h5>
<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/7TF00hJI78Y"></iframe>
@unicodeveloper
unicodeveloper / nav.client.controller.js
Created September 12, 2016 16:20
Cloudinary Blog Post - Part 1
app.controller('NavbarCtrl', function($scope, $auth) {
$scope.isAuthenticated = function() {
return $auth.isAuthenticated();
};
});
@unicodeveloper
unicodeveloper / login.client.view.html
Created September 12, 2016 16:22
Cloudinary Blog Post - Part 1
<div class="container">
<div class="row">
<div class="center-form panel">
<div class="panel-body">
<h2 class="text-center">Log in</h2>
<form method="post" ng-submit="login()" name="loginForm">
<div class="form-group has-feedback">
<input class="form-control input-lg" type="text" name="email" ng-model="user.email" placeholder="Email" required autofocus>
<span class="ion-at form-control-feedback"></span>
</div>
@unicodeveloper
unicodeveloper / auth.client.controller.js
Created September 12, 2016 16:23
Cloudinary Blog Post - Part 1
app.controller('AuthController', ['$scope','$location','$auth','toastr', function($scope, $location, $auth, toastr) {
$scope.login = function() {
$auth.login($scope.user)
.then(function() {
toastr.success('You have successfully signed in!');
$location.path('/');
})
.catch(function(error) {
toastr.error(error.data.message, error.status);
@unicodeveloper
unicodeveloper / create-user.client.view.html
Created September 12, 2016 16:25
Cloudinary Blog Post - Part 1
<div class="container">
<div class="row">
<div class="center-form panel">
<div class="panel-body">
<h2 class="text-center">Sign up</h2>
<form method="post" ng-submit="signup()" name="signupForm">
<div class="form-group has-feedback" ng-class="{ 'has-error' : signupForm.displayName.$invalid && signupForm.displayName.$dirty }">
<input class="form-control input-lg" type="text" name="fullName" ng-model="user.fullName" placeholder="Name" required autofocus>
<span class="ion-person form-control-feedback"></span>
<div class="help-block text-danger" ng-if="signupForm.fullName.$dirty" ng-messages="signupForm.fullName.$error">
@unicodeveloper
unicodeveloper / auth.client.controller.js
Created September 12, 2016 16:26
Cloudinary Blog Post - Part 1
$scope.signup = function() {
$auth.signup($scope.user)
.then(function(response) {
$auth.setToken(response);
$location.path('/');
toastr.info('You have successfully created a new account and have been signed-in');
})
.catch(function(response) {
console.log(response);
toastr.error(response.data.message);
@unicodeveloper
unicodeveloper / profile.client.controller.js
Created September 12, 2016 16:28
Cloudinary Blog Post - Part 1
app.controller('ProfileController', ['$scope','$http','toastr','User', function($scope, $http, toastr, User) {
$scope.getProfile = function() {
User.getProfile()
.then(function(response) {
$scope.user = response.data;
})
.catch(function(response) {
toastr.error(response.data.message);
});
@unicodeveloper
unicodeveloper / user.client.service.js
Created September 12, 2016 16:29
Cloudinary Blog Post - Part 1
app.factory('User', ['$http', function($http) {
return {
getProfile: function(){
return $http.get('/api/me');
},
updateProfile: function(profile){
return $http.put('/api/me', profile);
}