Skip to content

Instantly share code, notes, and snippets.

View yusufola's full-sized avatar

Yusuf Olalere yusufola

View GitHub Profile
@yusufola
yusufola / aplicacao.js
Created October 18, 2017 11:18 — forked from ktabriga/aplicacao.js
Interceptor
(function () {
angular.module("amks", ['ui.router', 'restangular', 'aluno'])
.run(congiruarApp)
.factory('authInterceptor', Interceptador)
.config(adicionarInterceptador);
congiruarApp.$inject = ['Restangular'];
function congiruarApp(restangular) {
restangular.setBaseUrl('/api');
@yusufola
yusufola / Angular HTTP Interceptor.js
Created October 18, 2017 11:27 — forked from georgepaoli/Angular HTTP Interceptor.js
Angular HTTP Interceptor Sample
// Create HTTP interceptor (https://docs.angularjs.org/api/ng/service/$http - Interceptors topic)
App.factory('AuthInterceptor', ['$window', '$q', '$location', function ($window, $q, $location) {
return {
request: function (config) {
config.headers = config.headers || {};
config.headers.ContentType = 'application/json; charset=UTF-8';
if (myGlobalVar.getToken()) {
// populate header custom fields
config.headers.Authorization = 'Bearer ' + myGlobalVar.getToken().access_token;
config.headers.iduser = myGlobalVar.getToken().iduser;
@yusufola
yusufola / cInterceptor.js
Created October 18, 2017 11:30 — forked from krainet/cInterceptor.js
Interceptor angular para Walladog
/*
* Intercept all requests /responses
* Ej. use to auth-tokens in headers
*/
angular.module('cInterceptor', [])
.factory('cInterceptor', ['$q', '$rootScope', function ($q, $rootScope) {
return {
'request': function (config) {
config.headers = config.headers || {};
@yusufola
yusufola / angular image upload directive
Created October 18, 2017 11:41 — forked from xjinza/angular image upload directive
angular image upload directive
define(['jquery', 'message'], function($, scojs_message) {
'use strict';
/**
* The image upload directive
* @author: kehefu
* @version: 0.1.0, 2016-12-27
*/
var uploadModule = angular.module('upload', []);
uploadModule.directive('upload', ['$window', function($window) {
@yusufola
yusufola / .gitlab-ci.yml
Created April 17, 2021 14:12 — forked from superjose/.gitlab-ci.yml
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.