Skip to content

Instantly share code, notes, and snippets.

Avatar

Rémi Gérard-Marchant remitbri

View GitHub Profile
@remitbri
remitbri / bucklescript
Last active Nov 21, 2018
polymorphic variant typing problem
View bucklescript
17 ┆ jsStuff =>
18 ┆ switch (beeTypeFromJs(jsStuff)) {
>19 ┆ | Some(output) => output
20 ┆ | None => `baa
21 ┆ };
This has type:
beeType
But somewhere wanted:
stuff4
View keybase.md

Keybase proof

I hereby claim:

  • I am remitbri on github.
  • I am remitbri (https://keybase.io/remitbri) on keybase.
  • I have a public key whose fingerprint is B615 4337 FF39 1982 76C9 6205 CF55 6EFE 06D3 16F0

To claim this, I am signing this object:

View Icon.css
.Icon{
display: inline-block;
vertical-align: middle;
color: inherit;
}
.Icon--defaultSize{
width: 1rem;
}
.Icon-subcontainer{
View gist:d87ff67ff9d6eb66eda5

So, about this short conversation about containing thing, some examples where I think this is not such an obvious move as it sounds.

import React from 'react';

export class Icon extends React.Component {
  /* ... */
  getDefaultProps() {
    return {
View 00.Intro.md

React

A JavaScript library that manages the UI.

What does it do?

React enables you to express in a declarative way what your UI should look like at any point in time; while building your app with little, reusable blocks: components.

View gist:66062dac32b292e03c79

hexa to alpha

Useful for colour values, the 'AA' in #RRGGBBAA

alpha = parseInt(hexa,16)/255

for (i=0; i<256; i++) {
  console.log(i.toString(16), i/255)
}
View gist:c7ef255cc99a14b0ba6a

alpha to hexa

Useful for colour values, the 'AA' in #RRGGBBAA

hexa = Math.round(i*255).toString(16)

for (i=0; i<=1; i+=0.05) {
console.log(i, Math.round(i*255).toString(16))
}
@remitbri
remitbri / a11yClick View.js
Last active Aug 29, 2015
a11y click events, not just click, for keyboards too
View a11yClick View.js
module.exports = someViewFramework.extend({
element : ".js-thatElement",
events : {
"click" : "doStuff",
"keypress" : "doStuffKeyboard"
},
doStuff : function() {
// foo
@remitbri
remitbri / console.js
Created Nov 24, 2014
when someone had the “great” idea to redefine window.console…
View console.js
Object.getPrototypeOf(console).log.call(console, val1, val2, )
View scrollTop.js
(document.documentElement || document.body.parentNode || document.body).scrollTop;