Skip to content

Instantly share code, notes, and snippets.

View auxcoder's full-sized avatar
🗼
Working from home

AuxCoder auxcoder

🗼
Working from home
View GitHub Profile
@auxcoder
auxcoder / regex.md
Last active August 20, 2018 21:20 — forked from nerdsrescueme/regex.txt
Common Regex

Javascript Regex

Remove html tags

var regex = /(<([^>]+)>)/ig;
var htmlContent = "<p>test</p>";
var result = htmlContent.replace(regex, "");

console.log(result);
@auxcoder
auxcoder / app.js
Created January 4, 2016 03:24 — forked from victorb/app.js
Easy AngularJS Directive for Google Places Autocomplete
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};
@auxcoder
auxcoder / google-autocomplete-directive.js
Created January 10, 2016 20:04
Google Autocomplete Address Places
(function() {
'use strict';
angular
.module('myApp')
.directive('googlePlaces', googlePlaces);
/** @ngInject */
function googlePlaces(){
return {
@auxcoder
auxcoder / index.config.js
Created January 10, 2016 23:58
Transform an object to x-www-form-urlencoded serialization
angular.module('engageAngularApp')
.config(transformRequest)
/** @ngInject */
function transformRequest($httpProvider) {
// Enable cross domain calls
// $httpProvider.defaults.useXDomain = true;
// Remove the header used to identify ajax call that would prevent CORS from working
// delete $httpProvider.defaults.headers.common['X-Requested-With'];
@auxcoder
auxcoder / index.config.js
Last active January 11, 2016 00:08
httpInterceptorFactory to manage authentication token in header and redirection
(function() {
'use strict';
angular.module('engageAngularApp')
.config(httpInterceptor);
/** @ngInject */
function httpInterceptor($httpProvider) {
$httpProvider.interceptors.push('httpInterceptorFactory');
}
@auxcoder
auxcoder / index.route.js
Last active January 15, 2016 15:23
ui-router-with-resolve-example
(function() {
'use strict';
angular
.module('myApp')
.config(routeConfig);
/** @ngInject */
function routeConfig($stateProvider, $urlRouterProvider) {
$stateProvider
@auxcoder
auxcoder / index.filters.js
Created January 15, 2016 19:36
Search by two atributes in an object (collections of customers)
(function() {
'use strict';
angular.module('engageAngularApp')
.filter('searchByNameAndPhone', function(){
return function(items, searchString){
if(!searchString){
return items;
}
@auxcoder
auxcoder / MyController.spec.js
Created January 20, 2016 14:17
$state mock for testing ui-router state
(function() {
'use strict';
describe('controllers', function(){
var scope, vm, state, $rootScope;
// Initialize the controller and scope
beforeEach(function () {
// Load the controller's module
module('AngularApp');
@auxcoder
auxcoder / README.md
Created March 20, 2016 23:38 — forked from chrisroos/README.md
Apache 2.4 on OS X Yosemite listening on ::1 and not 127.0.0.1

Apache appears to be listening on ::1 but not 127.0.0.1.

$ telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.

$ telnet 127.0.0.1 80
Trying 127.0.0.1...
@auxcoder
auxcoder / angularjs-providers-explained.md
Created March 30, 2016 15:34 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant