This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.filter("timeago", function () { | |
//time: the time | |
//local: compared to what time? default: now | |
//raw: wheter you want in a format of "5 minutes ago", or "5 minutes" | |
return function (time, local, raw) { | |
if (!time) return "never"; | |
if (!local) { | |
(local = Date.now()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.value("ngBasicInterval", function (fn, delay) { | |
(function repeat() { | |
$timeout(fn, delay).then(repeat); | |
}()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('nulls in expressions', function() { | |
var props = ['b', 'c', 'd']; | |
var contexts = [ | |
{ 'b': null }, | |
{ 'b': { 'c': null } }, | |
{ 'b': { 'c': { 'd': null } } } | |
]; | |
forEach(props, function (prop, index) { | |
var expr = props.slice(0, index+1).join('.'); | |
forEach(contexts, function (a, expectIndex) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test() { | |
if (true) { | |
let x = 1; | |
} | |
try{ | |
log(x); | |
} catch(e){console.log(e)} | |
if (typeof x !== 'undefined') console.log(x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test() { | |
let a = 4; | |
if (true) { | |
const x = 1; | |
var y = 2; | |
let a = 3; | |
a = x + y; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.formify = function formify(form, options) { | |
if (!(form instanceof HTMLFormElement)) { | |
throw new Error('Tried to Formify a non-form element: ' + form); | |
} | |
var opt = { | |
classPrefix: options.classPrefix || 'fm' | |
}; | |
var validityKeys = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT License | |
Copyright (c) 2020 Rodric Haddad | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |