Skip to content

Instantly share code, notes, and snippets.

Rodric Haddad rodyhaddad

  • Coddict
  • Lebanon
Block or report user

Report or block rodyhaddad

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rodyhaddad
rodyhaddad / formify.js
Last active May 5, 2017
Library to add CSS classes to form inputs, describing their different states
View formify.js
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 = [
View gist:57e060cc3100fab8bf53
function test() {
let a = 4;
if (true) {
const x = 1;
var y = 2;
let a = 3;
a = x + y;
}
View gist:a10b03286b23638c4b94
function test() {
if (true) {
let x = 1;
}
try{
log(x);
} catch(e){console.log(e)}
if (typeof x !== 'undefined') console.log(x);
View angularjs#5480-tests-suggestions.js
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) {
@rodyhaddad
rodyhaddad / ngBasicInterval
Created Aug 9, 2013
Angular Basic setInterval
View ngBasicInterval
app.value("ngBasicInterval", function (fn, delay) {
(function repeat() {
$timeout(fn, delay).then(repeat);
}());
});
@rodyhaddad
rodyhaddad / timeago.filter.js
Created Jun 30, 2013
timeago filter for angularjs
View timeago.filter.js
.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())
}
You can’t perform that action at this time.