Skip to content

Instantly share code, notes, and snippets.

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

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:

@remitbri
remitbri / Icon.css
Created July 16, 2015 22:42
my <Icon />
.Icon{
display: inline-block;
vertical-align: middle;
color: inherit;
}
.Icon--defaultSize{
width: 1rem;
}
.Icon-subcontainer{
@remitbri
remitbri / gist:d87ff67ff9d6eb66eda5
Last active August 29, 2015 14:21
Wrapping things up

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 {

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.

@remitbri
remitbri / gist:66062dac32b292e03c79
Last active August 29, 2015 14:17
table hexa to alpha

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)
}
@remitbri
remitbri / gist:c7ef255cc99a14b0ba6a
Last active August 29, 2015 14:17
table alpha to hexa

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 August 29, 2015 14:10
a11y click events, not just click, for keyboards too
module.exports = someViewFramework.extend({
element : ".js-thatElement",
events : {
"click" : "doStuff",
"keypress" : "doStuffKeyboard"
},
doStuff : function() {
// foo
@remitbri
remitbri / console.js
Created November 24, 2014 18:56
when someone had the “great” idea to redefine window.console…
Object.getPrototypeOf(console).log.call(console, val1, val2, …)
(document.documentElement || document.body.parentNode || document.body).scrollTop;