Skip to content

Instantly share code, notes, and snippets.

View aenario's full-sized avatar

Romain Foucault aenario

View GitHub Profile

Packaging*

D'expérience, gérer plusieurs package c'est galère (la joie de faire 3 npm publish pour corriger un bug) Si on duplique le code entre cozy-client-js & cozy-client, cozy-client-js va diverger et pourrir, mais c'est dommage de se lier à 100% avec Redux+React (qui introduit des concepts pas évidents pour les habitués d'autres FrameWorks) --> monorepo avec cozy-client-js & cozy-client ?

<3 Apollo & GraphQL*

  • Si c'est vraiment la solution, on peut aussi évaluer l'ajout d'un endpoint graphql à la stack plutot que de re-engineer 3 niveau d'abstraction.

JSONAPI*

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x40307d]
goroutine 1 [running]:
panic(0x812480, 0xc42000c120)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
main.export.func1(0x884fba, 0xa, 0x0, 0xa6b2e0, 0xc42015eff0, 0xc42015eff0, 0x20)
/home/romain/Cozy/goworkspace/src/github.com/cozy/cozy-stack/imexport/export.go:47 +0x10d
github.com/cozy/cozy-stack/client.(*Client).WalkByPath(0xc4202040d0, 0x884fba, 0xa, 0xc4201f41c0, 0x4014d1, 0xc4200dbc20)
/home/romain/Cozy/goworkspace/src/github.com/cozy/cozy-stack/client/files.go:354 +0xd1
=== RUN TestInMemoryJobs
setNbSlots 4
setNbSlots 4
broker2 push &jobs.Message{Data:[]uint8{0x22, 0x62, 0x2d, 0x31, 0x22}, Type:"json"}
PushJob &jobs.JobRequest{Domain:"cozy.local", WorkerType:"test", Message:(*jobs.Message)(0xc4201a42a0), Options:(*jobs.JobOptions)(nil)}
broker1 push &jobs.Message{Data:[]uint8{0x22, 0x61, 0x2d, 0x31, 0x22}, Type:"json"}
PushJob &jobs.JobRequest{Domain:"cozy.local", WorkerType:"test", Message:(*jobs.Message)(0xc4201cc000), Options:(*jobs.JobOptions)(nil)}
Cannot save &jobs.JobInfos{JobID:"", JobRev:"", Domain:"cozy.local", WorkerType:"test", Message:(*jobs.Message)(0xc4201a42a0), Options:(*jobs.JobOptions)(nil), State:"queued", QueuedAt:time.Time{sec:63630632713, nsec:590425291, loc:(*time.Location)(0xb06cc0)}, StartedAt:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}, Error:""}: CouchDB(file_exists): The database could not be created, the file already exists.
broker2 push &jobs.Message{Data:[]uint8{0x22, 0x62, 0x2d, 0x32, 0x22}, Type:"json"}
PushJob &jobs.JobRequest{Dom
May 16 14:26:12 gozy-01-int cozy-stack[7970]: time="2017-05-16T14:26:12Z" level=warning msg="[konnector] konnector/2/trainline/recette.cozy.works: Stdout: [5275264.157871] konnector-2-trainline-recette-cozy-works[5]: [2017-05-16 14:26:12:185] info - Trainline | Import succeeded."
May 16 14:26:12 gozy-01-int cozy-stack[7970]: time="2017-05-16T14:26:12Z" level=warning msg="[konnector] konnector/2/trainline/recette.cozy.works: Stdout: [5275264.158572] konnector-2-trainline-recette-cozy-works[5]: The konnector has been run"
May 16 14:26:12 gozy-01-int sudo[8623]: cozy : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/rkt stop --force --uuid-file=/tmp/konnector-trainline645774966/.rkt/uuid
May 16 14:26:12 gozy-01-int cozy-stack[7970]: time="2017-05-16T14:26:12Z" level=error msg="[konnector] konnector/2/trainline/recette.cozy.works: Stderr: pod "b71ca647-abb4-4bd1-af10-9001f68fa88f" is already stopped"
May 16 14:26:12 gozy-01-int sudo[8630]: cozy : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/rkt rm --uuid
yarn run v0.17.8
$ "/home/romain/Cozy/cozy-client-js/node_modules/.bin/prebuild"
prebuild info begin Prebuild version 4.5.0
/home/romain/Cozy/cozy-client-js/node_modules/prebuild/prebuild.js:14
if (target[0] !== 'v') target = 'v' + target
^
TypeError: Cannot read property '0' of undefined
at prebuild (/home/romain/Cozy/cozy-client-js/node_modules/prebuild/prebuild.js:14:13)
at /home/romain/Cozy/cozy-client-js/node_modules/prebuild/bin.js:87:5
@aenario
aenario / exemple.diff
Created August 31, 2016 07:37
Exemple reselect getter/router
diff --git a/client/app/getters/router.coffee b/client/app/getters/router.coffee
index 50f0cb6..8bd9e24 100644
--- a/client/app/getters/router.coffee
+++ b/client/app/getters/router.coffee
@@ -1,6 +1,7 @@
Routes = require '../routes'
{MessageFilter} = require '../constants/app_constants'
Immutable = require 'immutable'
+{createSelector} = require 'reselect'

diff --git a/client/test/account_action_creator.spec.js b/client/test/account_action_creator.spec.js

  • change Dispatcher to new specs_dispatcher

diff --git a/client/test/account_store.spec.js b/client/test/account_store.spec.js

  • change Dispatcher to new specs_dispatcher
  • no polymorphisme
@aenario
aenario / account_store.coffee
Created November 17, 2015 12:51
Store unit testing
should = require 'should'
path = require 'path'
global.Immutable = require 'immutable'
global.EventEmitter = require('events').EventEmitter
global.t = (x) -> "translated #{x}"
global.__DEV__ = true
global.window = cozyMails:
logAction: ->
customEvent: ->
Imap = require 'imap'
imap = new Imap
user: 'xxxxx@gmail.com',
password: '*****',
host: 'imap.gmail.com',
port: 993,
tls: true
imap.once 'error', (err) -> console.log err
axon = require('axon');
// start axon's socket
socket = axon.socket('sub-emitter')
socket.connect(9105) // 9105 is the data-system axon port
socket.on('file.*', function(event, id){
// event is one of 'create', 'update', 'delete'
// id == id of the updated file
File.find(id, function(err, updatedFile){
// do anything with the file
});