Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles Bonnissent cbonnissent

View GitHub Profile
View promiseDebouncer.js
let syncReturnPromise = null;
let resolveReturn = null;
let actionSave = [];
syncReturn(Vue, $store, apiResponse, action = false) => {
if(action){
actionSave.push(action);
}
if (syncReturnPromise !== null) {
resolveReturn(Vue, $store, apiResponse);
View dashboard.yaml
dashboard "Food":
- h1 text: Food
- h2 text: By caloric content
- 3 columns:
- rows:
- h3 text: Bananas
- pie chart: {
"columns": [
["Protein", 5], ["Sugar", 10], ["Other carbs", 40], ["Fat", 1]
]
View amd_async.js
(function amdRequire(root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define([
'jquery',
'underscore',
'mustache',
'deps1',
'deps2'
View umd_require.js
(function umdRequire(root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define([ < dependances > ], factory);
} else {
factory( < dependances > );
}
}(window, function widget(
View amd.js
define([ < dependances > ], function init() {
$.widget("<nom_du_module>", < module_parent > , function widget() {...
});
@cbonnissent
cbonnissent / documentControllerevent.js
Last active Aug 29, 2015
documentController event
View documentControllerevent.js
$.ready(function() {
var myDocumentCheck = function(document) { return document.family.name === "ANIMAL" && document.view.id === "view1"};
//Ajouter un event au ready
window.dcp.document.documentController("addEvent", "ready", {
"documentCheck" : myDocumentCheck,
"name" : "myEvent.animal"
}, function(document) {
View synchronize.js
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
// Default options, unless specified.
_.defaults(options || (options = {}), {
emulateHTTP: Backbone.emulateHTTP,
emulateJSON: Backbone.emulateJSON
});
// Default JSON-request options.
View document.html
<html>
<head></head>
<body>
<header class="head">
<ul class="menu">
<li class="menu__item">Menu 1</li>
<li class="menu__item">Menu 2</li>
<li class="menu__item">Menu 3</li>
</ul>
</header>
View modalBootstrap.js
(function ($, _, Backbone) {
var template = _.template(
'<div class="modal-dialog modal-lg">' +
'<div class="modal-content">' +
'<div class="modal-header">' +
' <% if (allowCancel) { %> ' +
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>' +
' <% } %>' +
' <h3 class="js-modal-title css-modal-title"><% if (title) { %><%=title%><% } %></h3>' +
@cbonnissent
cbonnissent / app.js
Last active Dec 19, 2015
Some fun with d3.js
View app.js
(function() {
var width = 960,
height = 500,
outer = d3.select("#graph")
.append("svg:svg")
.attr("width", width)
.attr("height", height)
.attr("pointer-events", "all");
})();
You can’t perform that action at this time.