Skip to content

Instantly share code, notes, and snippets.

@peduarte
peduarte / esnextbin.md
Last active February 18, 2021 21:35
Vanilla Throttle
@peduarte
peduarte / esnextbin.md
Last active August 25, 2022 14:55
Vanilla Debounce
@peduarte
peduarte / esnextbin.md
Last active November 6, 2016 15:02
RxJS – Suggest GH Users
@peduarte
peduarte / _readme.md
Last active November 2, 2016 13:15
RxJs Observable – Get Shits from Shit Pedro Says
@peduarte
peduarte / _readme.md
Last active November 2, 2016 13:16
Vanilla Observable – Get Shits from Shit Pedro Says
@peduarte
peduarte / testing-react-components.txt
Created April 13, 2016 10:02
jsdom + enzyme + ava
npm install --save-dev jsdom
// test-browser-env.js
import { jsdom } from 'jsdom';
global.document = jsdom('<body></body>');
global.window = document.defaultView;
global.navigator = window.navigator;
// package.json
<div>
<h2 class="Headline Headline--m">News headline</h2>
{@uiComponent name="byline" text="Tim Shipman, Political Editor" /};
{@uiComponent name="dip" text="First paragraph of news content will go here..." /};
{@uiComponent name="link" text="Read full story" modifider="primary" /};
</div>
/**
* Function to render a ui component
* @param params - any available parameters allowed
* @param params.name
* @return {partial}
*/
dust.helpers.uiComponent = function (chunk, context, bodies, params) {
var name = context.resolve(params.name);
return chunk.partial('components/' + name + '/' + name, context, params);
};
/**
*
* T2 Module
*
**/
.T-2 {
@include medium {
@include tt-span(3);
}
/**
*
* NL1 Module
*
**/
.NL1 {
@include medium {
@include tt-span(9);
}