Skip to content

Instantly share code, notes, and snippets.

View Bubblesphere's full-sized avatar

Déric Dallaire Bubblesphere

View GitHub Profile
@Bubblesphere
Bubblesphere / clean_code_francais.md
Last active September 18, 2018 03:42 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Le code est propre s'il peut être compris facilement par tous les membres de l'équipe. Le code propre peut être lu et amélioré par un développeur autre que son auteur d'origine. Avec la compréhensibilité vient la lisibilité, la capacité de changement, l'extensibilité et la maintenabilité.


Règles générales

  1. Suivez les conventions standard.
  2. Reste simple bête. Plus simple, c'est toujours mieux. Réduisez la complexité autant que possible.
  3. Règle des scouts. Laissez le camping plus propre que vous l'avez trouvé.
  4. Toujours trouver la cause première. Recherchez toujours la cause fondamentale d'un problème.

Règles de conception

-- Nouveau nom pour type existant
type String = [Char] type Pos3D = (Float,Float,Float)
-- Type entièrement nouveau
data Bool = False | True
data Shape = Circle Float Float Float |
Rectangle Float Float Float Float
-- Pattern Matching -> fnc polymorphique
area :: Shape -> Float
area (Circle _ _ r) = pi * r ^ 2
@Bubblesphere
Bubblesphere / clapprExtension.js
Last active March 22, 2018 16:08
Hijacking the current time, total time & mouse over seek bar time with an offset for a non-live streamed source
var hijackSeekBarTime = Clappr.UICorePlugin.extend({
name: 'hijack_seekbar_media_control',
bindEvents: function () {
this.listenTo(this.core.mediaControl, Clappr.Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR, this.updateTime);
},
updateTime: function () {
// check out seek_time.js in order to understand how the offset is calculated
// https://github.com/clappr/clappr/blob/f1db5431225425d483639290fedc8a7c624e6c64/src/plugins/seek_time/seek_time.js
$("[data-seek-time]").html("0:00");
}