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
class Solution { | |
public: | |
vector<int> sortedSquares(vector<int>& nums) { | |
vector<int> result; | |
vector<int> negatives; | |
vector<int> positives; | |
for (const int& i : nums) { | |
if(i < 0) { | |
negatives.push_back(i*i); |
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
class Solution { | |
public: | |
vector<int> sortedSquares(vector<int>& nums) { | |
vector<int> result; | |
vector<int> negatives; | |
vector<int> positives; | |
for (const int& i : nums) { | |
if(i < 0) { | |
negatives.push_back(i*i); |
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
/** | |
* Template used to render a single stencil component. | |
*/ | |
function getStencilTemplate({ title, description }) { | |
let template = ` | |
<div class="component-area"> | |
<h2>${title}</h2> | |
${description ? '<p>' + description + '</p>' : ''} | |
<div class="placeholder"> | |
<!-- the component will be inserted here --> |
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
declare module '*.md'; |
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
import Case from 'case'; | |
/** | |
* Given a property (from stencil Component.properties) and an optional | |
* controlOptions object generates a control which can be used to | |
* dynamically update the properties of the component. | |
*/ | |
function getControlForProp(prop, controlOptions) { | |
let defaultVal = ''; | |
let control = { |
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
/** | |
* Template used to render a single stencil component. | |
*/ | |
function getStencilTemplate({ title, description }) { | |
let template = ` | |
<div class="component-area"> | |
<h2>${title}</h2> | |
${description ? '<p>' + description + '</p>' : ''} | |
<div class="placeholder"> | |
<!-- the component will be inserted here --> |
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
/** | |
* Generates DOM nodes from states to render. | |
*/ | |
function createNodes(el, elements) { | |
if (elements && elements.length > 0) { | |
elements.forEach(({ tag, innerText, props, children }) => { | |
let childEl = document.createElement(tag); | |
childEl.innerHTML = innerText; | |
if (props) { | |
Object.keys(props).forEach(prop => { |
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
import path from 'path'; | |
/** | |
* Given a module, iterates over the exports and returns the first | |
* one which looks like a stencil component (using duck typing). | |
*/ | |
function getComponentFromExports(_module) { | |
const key = Object.keys(_module).find(exportKey => { | |
const _export = _module[exportKey]; | |
// does it quack like a stencil class component? |
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
import { storiesOf } from '@storybook/html'; | |
/** | |
* Iterates all of the stencil contexts and build a "config" object | |
* which is used to generate the individual stories. | |
*/ | |
function buildStencilStories(name, componentsCtx, storiesCtx) { | |
const configs = buildGeneratorConfigs(componentsCtx, storiesCtx); | |
const stories = storiesOf(name, module); |
NewerOlder