Skip to content

Instantly share code, notes, and snippets.

@remitbri
remitbri / phoneNumberTextNotLink.html
Last active August 29, 2015 14:06
Disables automatic detection of possible phone numbers in a webpage in Safari on iOS
@remitbri
remitbri / noHighlightColorOnTap.css
Created September 8, 2014 16:32
Disables / overrides the highlight color shown when the user taps a link or a JavaScript clickable element in Safari on iPhone.
selector,
selector:hover,
selector:active,
selector:focus{
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
(document.documentElement || document.body.parentNode || document.body).scrollTop;
@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, …)
@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 / 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 / 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)
}

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: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 {
@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{