Skip to content

Instantly share code, notes, and snippets.

@pierr
pierr / web-app.html
Created December 6, 2012 17:35 — forked from tfausak/ios-8-web-app.html
iOS web app icons & startup images
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="yes" name="apple-mobile-web-app-capable">
<title></title>
<!-- iPhone -->
<link href="http://taylor.fausak.me/static/images/apple-touch-icon-57x57.png"
(function($) {
// Used by dateinput
$.expr = {':': {}};
// Used by bootstrap
$.support = {};
// Used by dateinput
$.fn.clone = function(){
var ret = $();
@pierr
pierr / Mediator.coffee
Last active December 18, 2015 16:39
Mediator pattern in coffee
## Pierre
# Implémentation d'un médiateur
###
Mediator
publish (event [args])
subscribe (event, cb)
unsubscribe (event, cb)
###
## Correction de Chistophe
Mediator =
/* global _ , window, Promise */
(function (NS) {
"use strict";
//Filename: helpers/message_helper.js
var isInBrowser = typeof module === 'undefined' && typeof window !== 'undefined';
//create a modal in the DOM.
var ModalView = isInBrowser ? NS.Views.ModalView : require('../views/modal-view');
var confirmView = new ModalView({ modalTitle: i18n.t('modal.confirm'), templateConsult: function () { return "" } });
//if (!$('div[data-modal-confirm]').length) {
//Register the modal in the DOM.
@pierr
pierr / Rules
Created October 12, 2014 09:29
Rules for Js Backbone dev
# Rules
@pierr
pierr / classic
Last active August 29, 2015 14:07
Backbone Promise
//Template d'une page de contact.
var templateContact = require('./template/contact');
//Vue représentact la page de contact.
var ContactView = Backbone.View.extend({
template: templateContact,
//Fonction d'initialisation de la vue de contact.
initialize: function initializeContactView(){
this.listenTo(this.model, 'model:invalid', this.renderErrors, this);
this.listenTo(this.model, 'model:valid', this.save, this);
@pierr
pierr / Require.md
Last active August 29, 2015 14:10
Require

Exercice sur require.js

Les fichiers index, module1 et module2 doivent être dans le même répertoire moduleTest.

moduleTest
|__module1
|__module2

test.js
@pierr
pierr / defaultOptions.js
Last active August 29, 2015 14:10
Focus view options
{
/**
* Does the view has to load the model from the service define in `getModelSvc`.
* @type {Boolean}
*/
isModelToLoad: true, //By default the model is loaded.
/**
* If true, there is an edit mode in the view.
* @type {Boolean}
*/
@pierr
pierr / .bashrc
Created December 5, 2014 08:56
node modules path windows
PATH=/c/Users/{userName}/AppData/Roaming/npm/:$PATH
@pierr
pierr / percent-jquery.js
Last active August 29, 2015 14:11
formatter
function(){
if(!jQuery){
throw new Error('JQuery should be define');
}
$.fn.percentify = function(options){
function parseValue(value){
//Code à faire pour parser la valeur.
return value.slice(0,-1);
}