This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isEventComponent = (component) -> | |
component._listeners? | |
findNearestEventComponent = (component) -> | |
if (isEventComponent component) | |
component | |
else if component._owner | |
findNearestEventComponent component._owner | |
else | |
null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button = react.createClass | |
displayName: 'Button' | |
mixins: [EventMixin] | |
handleClick: -> | |
@emit 'click' | |
@bubble 'dropdown.open', x: 10, y: 20 # Bubble the event up the component chain | |
render: -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I can do | |
React.DOM.div null, | |
React.DOM.div null, 'hello' | |
React.DOM.div null, 'world' | |
# Instead of | |
React.DOM.div null, [ | |
React.DOM.div null, 'hello' | |
React.DOM.div null, 'world' | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let reqImage = require.context('./images', true, /\.png/); | |
reqImage.keys().forEach(reqImage); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function TorrentStore() { | |
EventEmitter.call(this); | |
} | |
TorrentStore.prototype = Object.assign({}, EventEmitter.prototype, { ... }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The MIT License (MIT) | |
Copyright (c) 2015 Alexandre Kirszenberg | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let [date, time] = dateObj.toISOString().split('T'); | |
time = time.split('.')[0].split(':').slice(0, 2).join(':'); | |
let dateObj = new Date(`${date}T${time}.000Z`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let propTypes = { | |
children(props, propName) { | |
let errors = []; | |
React.Children.map(props[propName], child => { | |
if (child.type !== Foo) { | |
errors.push(`${child.key} is not a Foo element`); | |
} | |
}); | |
if (errors.length > 0) { | |
return new Error(errors.join(', ')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"shell_cmd": "type $file | ocaml", | |
"selector": "source.ml" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name YouTube Player for edX | |
// @namespace morhaus | |
// @version 1.1 | |
// @description Replace the default edX video player with the YouTube player | |
// @author Alexandre Kirszenberg <alexandre.kirszenberg@gmailcomr> | |
// @match https://courses.edx.org/* | |
// @match https://courses.ionisx.com/* | |
// @grant none | |
// ==/UserScript== |
OlderNewer