Skip to content

Instantly share code, notes, and snippets.

View bloodyowl's full-sized avatar
🦉

Matthias Le Brun bloodyowl

🦉
View GitHub Profile
@bloodyowl
bloodyowl / 00_README.md
Last active January 6, 2017 18:01
POC: minimal Backbone subset written in ES6/ES7

POC: minimal Backbone subset written in ES6/ES7

@bloodyowl
bloodyowl / 00.Intro.md
Last active December 13, 2017 13:36
Introduction to React

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.

export default function arrayShallowEqual(left, right) {
if(left.length !== right.length) {
return false
}
return !left.some((item, index) => item !== right[index])
}
@bloodyowl
bloodyowl / gist:5d8adcf50e890ebafb95
Last active September 30, 2023 16:49
ES6 tl;dr; for beginners
// ES6 tl;dr; for beginners
// 1. variables
// `const` & `let` are scoped at the block level
if(true) {
let foo = "bar"
}
foo // ReferenceError
@bloodyowl
bloodyowl / gist:60782502852b1069c5b0
Created March 31, 2015 16:43
fixed the js date issues
class ImmutableDate extends Date {
constructor(...args) {
this._date = new Date(...args)
}
}
const methods = {
toString: false,
toISOString: false,
toUTCString: false,
class AccessibleComponent extends Component {
render() {
return (
<div>
<div aria-label={this.props.label}>foo</div>
</div>
)
}
}
import React, {Component} from "react"
import shallowEqual from "react/lib/shallowEqual"
/**
* example :
*
* import React, {Component, PropTypes} from "react"
*
* class MyComponent extends Component {
*
@bloodyowl
bloodyowl / example.js
Created March 2, 2015 20:43
animation
const origin = window.pageYOffset
const destination = 3000
animate({
duration : 500,
tick(progress) {
window.scrollTo(
0,
progress * destination +
(1 - progress) * origin
export default class Store {
listeners = new Set()
constructor(dispatcher) {
this.reactions = this.getActionHandlers()
this.dispatcher = null
this.dispatchToken = null
this.actionHandler = this.actionHandler.bind(this)
this._getOriginalState()
+----------------+
| INITIALISATION |
+--+-------------+
|
+--v--------------------+
+-------+ INITIAL DATA FETCHING |
| +--+--------------------+
| |
| +--v------------------+
| | DOM EVENT LISTENING |