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
@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;
@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;
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();
import Ember from 'ember';
export default Ember.Component.extend({
isCoco: false,
index: 0,
/* mouseEnter() {
this.set('isCoco', true);
return false;
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
field1: {
label: 'mon texte',
value: 'Coucou!',
isDirty: true
},
@manufitoussi
manufitoussi / application.controller.js
Last active September 26, 2017 14:54
form field simplifié
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
field1: {
label: 'mon texte',
value: 'Coucou!',
isDirty: true
},
@manufitoussi
manufitoussi / application.controller.js
Last active September 26, 2017 16:17
form field simple
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
field1: {
label: 'mon texte',
value: 'Coucou!',
isDirty: true
},
@manufitoussi
manufitoussi / controllers.application.js
Created January 5, 2018 11:09
Test enqueue promises
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@manufitoussi
manufitoussi / constants.js
Last active March 7, 2018 13:14
benchmark multiple props
export default {
CONTAINERS_COUNT: 1000,
PROPS_COUNT: 100
}
@manufitoussi
manufitoussi / binding.js
Last active March 26, 2018 14:07
New Twiddle
import Em from 'ember'
export default Em.Object.extend({
source: null,
context: Em.computed.alias('source.source'),
path: '',
data: Em.computed('context', 'path', {
get() {
console.log('definition de l\'objet data');
var _data = this.get('_data');