Skip to content

Instantly share code, notes, and snippets.

View doubleface's full-sized avatar

Thiriot Christophe doubleface

  • Cozy Cloud
  • Gambais, France
View GitHub Profile
{
"id": "1285152415",
"title": "waiting",
"description": "",
"count": 34,
"songs": [
{
"id": "1115907",
"title": "Try Again",
"artist": "Aaliyah",
#!/bin/bash
curl -X PUT 'localhost:5984/secrets%2Fio-cozy-account_types'
~ curl -X PUT localhost:5984/secrets%2Fio-cozy-account_types/orangelivebox -d '{"grant_mode":"token_redirect_url", "auth_endpoint":"https://mesinfos.orange.fr/ auth"}'
+ curl -X PUT localhost:5984/secrets%2Fio-cozy-account_types/maif -d '{ "grant_mode": "authorization_code", "client_id": "2921ebd6-5599-4fa6-a533-0537fac62cfe", "client_secret": "Z_-AMVTppsgj_F9tRLXfwUm6Wdq8OOv5a4ydDYzvbhFjMcp8aM90D0sdNp2kdaEczeGH_qYZhhd9JIzWkoWdGw", "auth_endpoint": "https://connect.maif.fr/connect/authorize", "token_endpoint": "https://connect.maif.fr/connect/token", "token_mode": "basic" }'
diff --git a/app/containers/ConnectorManagement.jsx b/app/containers/ConnectorManagement.jsx
index 84d38f6..1f1a95f 100644
--- a/app/containers/ConnectorManagement.jsx
+++ b/app/containers/ConnectorManagement.jsx
@@ -77,6 +77,10 @@ export default class ConnectorManagement extends Component {
error = error.errors[0].detail
}
+ if (error.message) {
+ error = error.message
$ = jQuery
queues = {}
running = false
queue = (name) ->
name = 'default' if name is true
queues[name] or= []
next = (name) ->
@doubleface
doubleface / gist:5884474
Created June 28, 2013 12:55
Handling login in a backbone application
@doubleface
doubleface / gist:5850692
Created June 24, 2013 15:01
Backbone _super shortcut

From Utility functions for Backbone.js

Ease calling super() when overriding a method

It's a common practice to override view.remove() method to add custom logic. When doing that we should never forget to call parent's remove() method:

Backbone.View.extend({
    remove: function() {
        // ... custom logic
@doubleface
doubleface / gist:5850680
Created June 24, 2013 14:59
Log all backbone events

From Utility functions for Backbone.js

It's common to debug all events coming from a model/view/collection. An easy way to accomplish this is to enable debugging of all events:

Backbone.Collection.prototype.debugEvents =
Backbone.Model.prototype.debugEvents =
Backbone.View.prototype.debugEvents =
Backbone.Router.prototype.debugEvents = function() {
    this.on('all', function(eventName) {

console.log('[debug event] --> ', eventName, Array.prototype.slice.call(arguments, 1))

@doubleface
doubleface / gist:5850526
Created June 24, 2013 14:38
Backbone global event listener with Backbone.Events

From Backbone.js tips and tricks

Create a global event listener with Backbone.Events

In BackboneJS, each Backbone.View, Backbone.Model, Backbone.Collection, Backbone.Router and Backbone.History prototypes inherits from Backbone.Events, and it further means you have access to on(), off(), trigger() methods to manage your events.

The main problem with this approach is you have multiple listener instances. If you instanciate a viewA and another viewB, they do not have the same instance of Backbone.Events. That is to say, an event dispatched in viewA will not be received in viewB.

The workaround is to create a global event listener and inject it in each view: