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 / supplant.js
Created August 8, 2016 16:01 — forked from pbroschwitz/supplant.js
supplant - Crockford
/**
* supplant() does variable substitution on the string. It scans through the string looking for
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object,
* and if the key has a string value or number value, it is substituted for the bracket expression
* and it repeats.
*
* Written by Douglas Crockford
* http://www.crockford.com/
*/
String.prototype.supplant = function (o) {
@auxcoder
auxcoder / createPromiseSpy.js
Created August 6, 2016 16:12 — forked from bbraithwaite/createPromiseSpy.js
Utility function for working with promises in angular tests.
var createPromiseSpy = function(obj, name, method, $q) {
var createdSpy = jasmine.createSpy(name, obj);
var returnObj = {};
var promise = {};
if (typeof(method) === 'string') {
var deferred = $q.defer();
spyOn(createdSpy, method).and.returnValue(deferred.promise);
promise[method] = deferred;
}
@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

@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 / 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 / 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);