Skip to content

Instantly share code, notes, and snippets.

View niisar's full-sized avatar
🎯
Focusing

Mohammed Nisar Ansari niisar

🎯
Focusing
View GitHub Profile
@niisar
niisar / Stack.js
Last active August 29, 2015 14:27
Stack Class Implementation
function Stack(){
this.dataStore = [];
this.top =0;
this.push = push;
this.pop = pop;
this.peek = peek;
this.length = length;
this.clear = clear;
}
@niisar
niisar / Queue.js
Created August 26, 2015 13:24
Queue Class Implementation
function Queue(){
this.dataStore = [];
this.enqueue = enqueue;
this.dequeue = dequeue;
this.front = front;
this.back = back;
this.toString = toString;
this.empty = empty;
}
@niisar
niisar / LList.js
Created August 30, 2015 10:16
Linked List Class Implementation
// Constructor function that sets the values of two properties.
function Node(element){
this.element = element;
this.next=null;
}
// Defination for the LList constructor function
function LList(){
this.head = new Node("head");
this.find = find;
@niisar
niisar / authInterceptorService.js
Created February 8, 2016 14:17
AngularJSAuthentication.WEB
define(['app'], function (app) {
app.service('authInterceptorService', function ($q, $location, $localStorage) {
var authInterceptorServiceFactory = {};
var _request = function (config) {
config.headers = config.headers || {};
var authData = $localStorage.authorizationData;
if (authData) {
config.headers.Authorization = 'Bearer ' + authData.token;
}
return config;
@niisar
niisar / index.html
Created February 8, 2016 14:20
AngularJSAuthentication.WEB
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
table tr td{
padding:10px;
border:1px solid #808080;
}
</style>
@niisar
niisar / home.html
Created February 8, 2016 14:21
AngularJSAuthentication.WEB
{{k2}}
@niisar
niisar / homeCtrl.js
Created February 8, 2016 14:24
AngularJSAuthentication.WEB
define(['app'], function (app) {
app.controller("homeCtrl", function ($scope, $localStorage) {
$scope.k2 = "i am home";
});
})
@niisar
niisar / login.html
Created February 8, 2016 14:24
AngularJSAuthentication.WEB
<input type="text" placeholder="Username" data-ng-model="loginData.userName" required autofocus>
<input type="password" placeholder="Password" data-ng-model="loginData.password" required>
<button type="button" data-ng-click="login()">Login</button>
@niisar
niisar / loginCtrl.js
Created February 8, 2016 14:25
AngularJSAuthentication.WEB
define(['app'], function (app) {
app.controller("loginCtrl", function ($scope, $http, $localStorage, $state, cnst) {
$scope.loginData = {
userName: "",
password: ""
}
$scope.message = "";
$scope.login = function () {
delete $localStorage.authorizationData;
var data = "grant_type=password&username=" + $scope.loginData.userName + "&password=" + $scope.loginData.password;
@niisar
niisar / order.html
Created February 8, 2016 14:25
AngularJSAuthentication.WEB
{{orders}}