Skip to content

Instantly share code, notes, and snippets.

View ArnaudRinquin's full-sized avatar
🦆
rubber ducking

Arnaud Rinquin ArnaudRinquin

🦆
rubber ducking
View GitHub Profile
@ArnaudRinquin
ArnaudRinquin / Notes.md
Created January 17, 2024 09:03
Navie > Better > twc

What's interesting to note on this not so trivial example (we have variants -> className; base style attrs that can be expended)

  • comprehensive img props types + automatically passed
  • auto extra classNames (& style) merging
  • auto ref forwarding, if need be

It's debatable that writing such component is simpler than the classic approach but the outcome is undoubtly better.

There are also nice ways to handle variants and such.

@ArnaudRinquin
ArnaudRinquin / style.less
Created August 10, 2017 10:39
Operator Moni + Fire for Atom
atom-text-editor {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-family: "Operator Mono";
font-weight: 500;
}
atom-text-editor.editor {
.syntax--storage.syntax--type.syntax--function.syntax--arrow,
.syntax--keyword.syntax--operator:not(.accessor),
@ArnaudRinquin
ArnaudRinquin / mapWrapper.js
Created July 26, 2017 08:43
react-leaflet + flyTo
import { Component } from 'react'
import { connect } from 'react-redux'
class MapWrapper extends Component {
render() {
const mapProps = 123 // todo
return <LeafletMap ref={(mapEl) => this.mapEl = mapEl} {...mapProps} />
}
componentDidMount() {
const { markerData } = this.props
@ArnaudRinquin
ArnaudRinquin / example.js
Created March 15, 2017 14:59
DraftJS, Intercept copy events
componentDidMount() {
this.el.addEventListener('copy', this.onCopy)
}
onCopy = (event) => {
const { editorState } = this.props
const contentState = editorState.getCurrentContent()
const html = convertToHTML(contentState);
console.log('converted!', html);
// TODO put reulst in the clipboard
apiVersion: v1
kind: Service
metadata:
name: {{ template "mongo-arbiter-name" . }}
labels:
name: {{ template "mongo-arbiter-name" . }}
spec:
ports:
- port: 27017
selector:
@ArnaudRinquin
ArnaudRinquin / README.md
Last active December 2, 2015 17:13
envtojson

Usage: envtojson [indent]

EDIT: I created the package ¯\_(ツ)_/¯

@ArnaudRinquin
ArnaudRinquin / angular-userList.js
Last active June 14, 2016 10:09
The API layer we want
// This one is more or less what you could do in angular 2
import { getUsers } from './userAPI';
import { Component } from 'angular2';
@Component({
template: '<pre>{{this.users}}</pre>'
});
export class UserList {
constructor() {
// for sake of example only, don't call APIs in constructors
@ArnaudRinquin
ArnaudRinquin / README.md
Created October 12, 2015 23:54
periscope-stats

periscope-stats

Store and prepare periscope statistics from live periscope.tv info streams.

Usage

The first step is to get some data from a periscope PUBNUB stream. The easiest way probably is to use peristream. The following examples uses peristream.

@ArnaudRinquin
ArnaudRinquin / README.md
Created October 10, 2015 23:12
peristream

Peristream

A wrapper around periscope.tv event streams, allowing you to easilly access them

Usage

npm i -S peristream