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 / 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

@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 / 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 / .eslintrc
Created January 3, 2017 18:20 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@auxcoder
auxcoder / angularjs_directive_attribute_explanation.md
Created February 23, 2017 18:09 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@auxcoder
auxcoder / upgrade-guide.md
Last active July 20, 2017 13:30 — forked from joho/gist:3735740
PostgreSQL upgrade steps and common commands

Steps to install and run PostgreSQL using Homebrew (Mac OS X)

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Rename the old version and update PostgreSQL

mv /usr/local/var/postgres /usr/local/var/postgres91
brew update
@auxcoder
auxcoder / typescript_angular.adoc
Created August 10, 2017 03:59 — forked from esfand/typescript_angular.adoc
AngularJS with TypeScript