Legal stuff about this site and your private life:

  • We use a cookie to keep your preferences (language, NSFW status, login status) during navigation.
  • We use your local storage to save the announces you closed (like this one).
  • We don't save informations you don't give
  • We don't share your email address if you comment or register
  • There is no tracker of any kind.

If you're not OK with this, move your way.

Rails: Check Pundit authorization in RSpec

Pundit provide two helper methods to help you ensure the actions are authorized/scoped: verify_authorized and verify_policy_scoped. They are meant to be used in an after_action hook.

As the check is made after the action, I see no point of using it in production, so I use it in RSpec:

# rails_helper.rb
# ...
config.before(:suite) do
  FactoryBot.create :user, :known
  ApplicationController.send(:after_action, :verify_authorized, {except: [:index]})
  ApplicationController.send(:after_action, :verify_policy_scoped, {only: [:index]})
end
# ...

This way, it's still checked during all the tests using controllers.

Rail: sending emails via a rake task won't work if you use the_mail.deliver_later. Use the_mail.deliver, instead.

Keep in mind that .deliver will be blocking in the context of the Rails server.

I heard that finding names for projects is "the hardest thing in development, after cache invaliadation". And that's right.

"Site compare" was a bad name because of two things: it compares sites, that's true. But it does not compare sites. So that's false.

"Capyxel"? After all, that does not mean anything, but it's about Capybara and pixels. Without being too obvious. So why not?

If you have issues with the KDE menu / KRunner items (items not appearing, wrong targets on .desktop entries, ...), you can try to rebuild the cache by running kbuildsycoca5 as an user.

After testing Vuex(3.0.1) in a Nativescript-vue (2.0) app I noticed that when using ModalViews or ListViews, $store is not available in the list items components or modal component. For now, use a StackLayout for lists and I pass the $store as a prop to the ModalView:

<!-- Instead of a ListView -->
<StackLayout class="list-group">
  <MyComponent v-for="item in items" :item="item" :key="item.id" class="list-group-item"/>
</StackLayout>

In MyComponent, the method to open the modal is like:

import ItemForm from '../forms/ItemForm'

export default {
  name: 'MyComponent',
  props: {
    item: { required: true, type: Object },
  },
  methods: {
    openForm () {
      const props = {item: this.item, store: this.$store} // props for ItemForm
      this.$showModal(ItemForm, { props })                // Show ItemForm as a ModalView
    },
  },
}
This content might not be appropriate for every situation.

Following VueX Modulator - Part 1: generating VueX modules (en)

I tested the "modulator" on a Nativescript-vue application and it works well. Use it like this:

// app/store.js

import Vue from 'nativescript-vue'
import Vuex from 'vuex'

import Modulator from './modulator'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {},
  modules: {
    users: Modulator.generateModule('users', 'user', 'users', false, false),
  },
})

ExperimentsLabs is going Rails !

The new version is going to be a Rails engine. A pre-release version is already available if you want to test it.

This content might not be appropriate for every situation.

Create a PDF file from resized images:

for file in *.png; do convert $file -resize 600 "imgtemp-$file"; done && convert imgtemp-*.png all_pngs.pdf && rm imgtemp-*.png

A new Userstyle hightlighting GAFA links has been created from the Firefox addon Gafalink, by Baptiste Gelez, for users of other browsers

User style

Site update (v0.1.0)

  • Updated this site to elabs 0.1.0

Site update(c31b499)

  • Set up an album system to group files together
  • Updated to CakePHP 3.3.9
  • Various fixes

Flash info : Nearly a month working with Laravel after work... And my first spam on the site.

New gist : Battleship game in C Game made as training exercise : Sources on Github. Linux only.

Site update(98da9c1):

  • Added comments system (comments are not public, only the author of a commented item can see them.)
  • Cleaned up Sass files and added an

Site update (222db47):

  • Created a simple toolbar for the CodeMirror fields
  • Added a preview mode for CodeMirror fields

Site update (fe0797f)

  • Minor fixes
  • Linked files/notes/posts to projects

Site update (6c32082):

  • Updated user preferences
  • Fixed an issue with old preferences.

Site update

Reflected the last changes made:

  • Language support
  • Full French translation
  • Notes module (255ch. texts)
  • Integrated PHPUnit tests
  • Integrated Code coverage
  • Bug corrections