This file contains 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
class Chart extends React.Component { | |
static propTypes = { | |
width: React.PropTypes.number, | |
height: React.PropTypes.number, | |
data: React.PropTypes.shape({ | |
x: React.PropTypes.number.isRequired, | |
y: React.PropTypes.number.isRequired | |
}).isRequired | |
}; |
This file contains 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
var loadImage = require('image').loadImage; | |
var images = [ | |
'url1', | |
'url2', | |
'url3', | |
//... | |
]; | |
Promise.all(images.map(loadImage)).then(function() { |
This file contains 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
import React from 'react'; | |
import throttle from 'lodash/function/throttle.js'; | |
import extend from 'lodash/object/extend.js'; | |
import getCaretPosition from 'caret.js'; | |
const TEST_DATA = [ | |
{ value: "SomethingNoSpaces", label: "Something No Spaces" } | |
]; |
This file contains 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
import React from 'react'; | |
export default class ShowOnRoute extends React.Component { | |
static contextTypes = { | |
router: React.PropTypes.func.isRequired | |
}; | |
static propTypes = { | |
name: React.PropTypes.string.isRequired, |
This file contains 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
// -------------------------------------------------- | |
// Flexbox LESS mixins | |
// The spec: http://www.w3.org/TR/css3-flexbox | |
// -------------------------------------------------- | |
// Flexbox display | |
// flex or inline-flex | |
.flex-display(@display: flex) { | |
display: ~"-webkit-@{display}"; | |
display: ~"-moz-@{display}"; |
This file contains 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
import React from 'react'; | |
import Marty from 'marty'; | |
import {RouteHandler} from 'react-router'; | |
import Login from 'pages/user/login.jsx'; | |
export default Marty.createContainer(RouteHandler, { | |
listenTo: ["stores.AuthStore"], | |
fetch: { |
This file contains 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
define(['foo1', 'foo2'], function(Foo1, Foo2) { | |
var test = Foo1.test; | |
test(Foo2); | |
return { | |
results: 'result' | |
}; | |
}); |
This file contains 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>IFrame Test (MB JJ)</title> | |
<style> | |
@media (min-width: 850px) { | |
.container { width: 100%; } | |
} | |
@media (min-width: 1056px) { |
This file contains 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
import cookie from 'cookie-cutter'; | |
App.on('before:start', () => { | |
//Safari does not respect P3P policies by default and blocks all 3rd party cookies (which is what our cookie is when | |
//loaded in an Iframe). To work around this we need to open a window to our application and set the cookies then | |
//close it. Safari allows us to interact with cookies that have already been set (but not create new ones). | |
if (cookie.get('expected_cookie') === undefined) { | |
//However, Safari (like all browsers) puts the kibosh on all windows that open without user interaction! | |
//Therefore we intercept all clicks to open the short-lived window that initializes all of our cookies. | |
$(document.body).one('click', '[data-goto]', e => { |
This file contains 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
import image from 'image'; | |
image | |
.load("/my/image/url") | |
.then(img => { | |
let canvas = document.createElement("canvas"); | |
canvas.width = img.width; | |
canvas.height = img.height; | |
canvas.getContext("2d").drawImage(img, 0, 0); | |
//... |