Skip to content

Instantly share code, notes, and snippets.

View evangalen's full-sized avatar

Emil van Galen evangalen

View GitHub Profile
<script type="text/javascript">
'use strict';
var defineGetterAndSetterProperty = function(sourceObject, targetObject, property) {
Object.defineProperty(targetObject, property, {
set: function (newValue) {
sourceObject[property] = newValue;
},
get: function () {
return sourceObject[property];
@evangalen
evangalen / app.js
Last active December 14, 2015 11:09
AngularJS Starter (for usage in "http://plnkr.co/")
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
});
@evangalen
evangalen / app.js
Created March 3, 2013 18:49
AngularJS Starter with Jasmine unit testing integrated (for usage in "http://plnkr.co/")
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
});
@evangalen
evangalen / $resource-with-default-update-action.js
Last active December 15, 2015 02:59
AngularJS module "ngResourceWithDefaultUpdateAction" which add a default "update" action to every $resource.
angular.module('$resource-with-update-action', ['ngResource'], function($provide) {
$provide.decorator('$resource', function($delegate) {
var decoratedResourceFactory = function(url, paramDefaults, actions) {
var actionsWithDefaultUpdateAction =
angular.extend({}, { 'update': { method:'PUT' } }, actions);
return $delegate(url, paramDefaults, actionsWithDefaultUpdateAction);
};
window.onerror = function(errorMsg, url, lineNumber) {
var text = document.documentElement.innerHTML;
var lines = text.match(/^.*((\r\n|\n|\r)|$)/gm);
var windowOnLoadLineNumber = null;
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
if (line.indexOf('window.onload') === 0) {
@evangalen
evangalen / app.js
Last active December 23, 2015 18:09
Plunk using the custom "jdOnlyLetters" directive that does show invalid valid (as opposed to: ng-pattern="/^[a-zA-Z]*$/")
angular.module('plunker', ['jdOnlyLetters']);
@evangalen
evangalen / app.js
Last active December 23, 2015 18:18
Plunk demonstrating a fix to render invalid values in a <input/> element; this effectively fixes AngularJS issue #1412 (= "input not showing invalid model values")
angular.module('plunker', ['jdFixInvalidValueFormatting']);
@evangalen
evangalen / app.js
Last active December 23, 2015 18:19
Plunk demonstrating a fix for AngularJS issue #1412 (= "input not showing invalid model values") as well a fix 2 inconsistencies in the parsing of data entry.
angular.module('plunker', ['jdFixInvalidValueFormatting', 'jdFixParsingInconsistencies']);
@evangalen
evangalen / app.js
Last active December 23, 2015 18:19
Plunk demonstrating AngularJS issue #1412 (= "input not showing invalid model values")
angular.module('plunker', []);
@evangalen
evangalen / index.html
Last active August 29, 2015 14:15 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://cdn.rawgit.com/babel/babel.github.io/master/scripts/babel.js"></script>
</head>
<body>
<script id="jsbin-javascript" type="text/babel">class A {};</script></body>