Skip to content

Instantly share code, notes, and snippets.

describe('Button', () => {
let utils;
describe('with default props', () => {
let button;
beforeEach(() => {
utils = render(<Button text="Test button text" styleProps={{}} btnClick={btnClick} />);
button = utils.getByRole('button');
});
@adamoliver
adamoliver / S3-Static-Sites.md
Created March 28, 2018 21:52 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

@adamoliver
adamoliver / authentication.jsx
Created February 15, 2018 23:36
Notes about React Authentication from TwigWorld/react-auth
// Authentication
const TeacherDashboard = () => <div>Teacher Dashboard</div>;
const StudentDashboard = () => <div>Student Dashboard</div>;
const Lesson = () => <div>Lesson page</div>;
// Wrap all components in Authentication component
// -> does request to get the `registrationStatus`
// -> sets a cookie
// -> reads from the cookie and places data into Redux store
@adamoliver
adamoliver / authorisation.jsx
Last active February 15, 2018 23:14
Authorisation with React, Redux and React Router
// Adapted from Hackernoon
// https://hackernoon.com/role-based-authorization-in-react-c70bb7641db4
const TeacherDashboard = () => <div>Teacher Dashboard</div>;
const StudentDashboard = () => <div>Student Dashboard</div>;
const Lesson = () => <div>Lesson page</div>;
// Authorization HOC
const Authorization = (allowedRoles) => (
@adamoliver
adamoliver / rotate.less
Created January 29, 2014 14:00
LESS Rotate mixin with IE 6-8 support
.rotate(@val) {
-ms-transform:rotate(0);
-webkit-transform: rotate(unit(@val, deg));
transform: rotate(unit(@val, deg));
/* IE6-IE8 */
@radians: ~`parseInt("@{val}") * Math.PI * 2 / 360`;
@costheta: ~`Math.cos("@{radians}")`;
@sintheta: ~`Math.sin("@{radians}")`;
@negsintheta: ~`"@{sintheta}" * -1`;
@adamoliver
adamoliver / export.jsx
Last active January 4, 2016 14:58
Photo exporting Photoshop script
if (typeof JSON !== 'object') {
JSON = {};
}
(function () {
'use strict';
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
@adamoliver
adamoliver / Preferences.sublime-settings
Created January 3, 2014 11:15
Sublime user settings
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_white_space": "all",
"font_size": 11.0,
"ignored_packages":
[
"Vintage"
],
"rulers":
[