Skip to content

Instantly share code, notes, and snippets.

@cimfalab
cimfalab / designer.html
Created December 24, 2014 09:27
designer
<link rel="import" href="../code-mirror/code-mirror.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@cimfalab
cimfalab / home.js
Created July 19, 2017 09:10
components/home.js
function renderSection(section, index) {
const content = [(
<div className={`fcol fg bullet-info ${(index % 2) ? '' : 'bullet-info-reversed'}`}>
<div className="bullet-point-title">
{section.title}
</div>
<div className="bullet-point-text">
{section.text}
</div>
</div>
@cimfalab
cimfalab / ReactDOMComponent-test.js
Created July 19, 2017 09:20
__tests__/ReactDOMComponent-test.js
it('should report component containing invalid styles', () => {
class Animal extends React.Component {
render() {
return <div style={1} />;
}
}
expect(function() {
ReactDOM.render(<Animal />, container);
}).toThrowError(
@cimfalab
cimfalab / form-general.jsx
Last active July 19, 2017 09:23
site-settings/form-general.jsx
import React, { Component } from 'react';
class SiteSettingsFormGeneral extends Component {
blogAddress() {
translate(
'Buy a custom domain, ' +
'map a domain you already own, ' +
'or redirect this site.',
{
components: {
domainSearchLink: (
@cimfalab
cimfalab / EventPluginHub-test.js
Created July 19, 2017 09:25
__tests__/EventPluginHub-test.js
it('should prevent non-function listeners, at dispatch', () => {
var node = ReactTestUtils.renderIntoDocument(
<div onClick="not a function" />,
);
expect(function() {
ReactTestUtils.SimulateNative.click(node);
}).toThrowError(
'Expected onClick listener to be a function, instead got type string',
);
});
@cimfalab
cimfalab / react-3-handleClick.js
Created July 19, 2017 09:27
react-3-handleClick
import React from 'react';
class Hello extends React.Component {
handleClick() {
console.log('clicked');
}
render() {
return (
<div onClick={this.handleClick}>
@cimfalab
cimfalab / details.js
Created August 11, 2017 04:12
details.js
updateZkConfigs: function (configs) {
var zks = this.getZkServerHosts();
var portValue = configs['zoo.cfg'] && Em.get(configs['zoo.cfg'], 'clientPort');
var zkPort = typeof portValue === 'udefined' ? '2181' : portValue;
var zksWithPort = this.concatZkNames(zks, zkPort);
this.setZKConfigs(configs, zksWithPort, zks);
},
@cimfalab
cimfalab / html5shiv.js
Last active August 11, 2017 08:59
html5shiv.js
define(['isSVG'], function(isSVG) {
/**
* @optionName html5shiv
* @optionProp html5shiv
*/
// Take the html5 variable out of the html5shiv scope so we can return it.
var html5;
if (!isSVG) {
/**
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
@cimfalab
cimfalab / number_utils.js
Created August 11, 2017 09:38
number_utils.js
validateInteger : function(str, min, max) {
if (str==null || str==undefined || (str + "").trim().length < 1) {
return Em.I18n.t('number.validate.empty');
} else {
...
}
return null;
},
@cimfalab
cimfalab / bulk_operations_controller.js
Last active August 11, 2017 10:15
bulk_operations_controller.js
_getComponentsFromServerForHostComponentsDecommissionCallBack: function (operationData, data) {
...
if (components.length) {
...
if (turn_off) {
// For recommession
if (svcName === "YARN" || svcName === "HBASE" || svcName === "HDFS") {
App.router.get('mainHostDetailsController').doRecommissionAndStart(hostNames, svcName, masterName, slaveName);
}
} else {