Skip to content

Instantly share code, notes, and snippets.

Avatar

Rémi Gérard-Marchant remitbri

View GitHub Profile
@remitbri
remitbri / phoneNumberTextNotLink.html
Last active Aug 29, 2015
Disables automatic detection of possible phone numbers in a webpage in Safari on iOS
View phoneNumberTextNotLink.html
@remitbri
remitbri / noHighlightColorOnTap.css
Created Sep 8, 2014
Disables / overrides the highlight color shown when the user taps a link or a JavaScript clickable element in Safari on iPhone.
View noHighlightColorOnTap.css
selector,
selector:hover,
selector:active,
selector:focus{
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
View scrollTop.js
(document.documentElement || document.body.parentNode || document.body).scrollTop;
@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, )
@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
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))
}
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: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 Icon.css
.Icon{
display: inline-block;
vertical-align: middle;
color: inherit;
}
.Icon--defaultSize{
width: 1rem;
}
.Icon-subcontainer{