Skip to content

Instantly share code, notes, and snippets.

View manufitoussi's full-sized avatar

Emmanuel Fitoussi manufitoussi

  • WIT SA
  • Nice, France
View GitHub Profile
import Ember from 'ember';
export default Ember.Component.extend({
isCoco: false,
index: 0,
/* mouseEnter() {
this.set('isCoco', true);
return false;
function(value) {
if (Em.isNone(value)) {
return null;
}
var dur = moment.duration(value, 'seconds');
var years = dur.years();
var months = dur.months();
var days = dur.days();
@manufitoussi
manufitoussi / sync.html
Last active March 17, 2020 15:25
Synchronisation between iframe hash and hosting window hash. Usefull with an Ember application with routes hosted in an iframe
<!DOCTYPE html>
<html lang="fr-fr">
<head>
<meta charset="utf-8">
<title>Ember App in an iframe</title>
<style>
body {
padding:0;
@manufitoussi
manufitoussi / add-days
Last active December 18, 2015 02:58
Method to add some days to a date. Takes into account any timezone offset.
/**
* Adds nb days to the specified date.
* @param {Date} the date.
* @param {Int} the number of days you want to add (or remove if negative).
* @return {Date} the shifted date.
*/
var addDays = function(date, nb) {
// day duration in ms.
var DAY = 1000*60*60*24;