Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jtomaszewski's full-sized avatar

Jacek Tomaszewski jtomaszewski

View GitHub Profile

Accessibility in Web

by Jacek Tomaszewski

Asana task

Accessibility

What is accessibility?

@jtomaszewski
jtomaszewski / axe.js
Last active March 11, 2019 22:41 — forked from donaldpipowitch/axe.js
aXe based a11y checks in your CI for Storybook
/* eslint-disable no-await-in-loop */
/* eslint-disable no-restricted-syntax */
// eslint-disable-next-line import/no-extraneous-dependencies
const puppeteer = require('puppeteer');
const { green, red, cyan, grey, bold } = require('chalk');
const url = 'http://localhost:9001/iframe.html';
function runAxe() {
return new Promise((resolve, reject) =>

Code formatting & linting

In AppUnite, we enforce proper code style by:

  1. formatting of all our **/*.{js,jsx,ts,tsx,css,less,scss} files with prettier,

  2. linting all **/*.js files with ESLint,

  3. linting all **/*.ts files with TSLint.

flatten = array => {
return array.reduce((sum, x) => {
if (Array.isArray(x)) {
return [...sum, ...flatten(x)];
} else {
return [...sum, x];
}
}, [])
};
// wrong (impure)
class DateTimePickerComponent {
timeZone: string = "Europe/Warsaw";
constructor(private account: AccountService) {
if (this.account.currentUser) {
this.timeZone = this.account.currentUser.timeZone;
}
}
<div class="sidebar">
<my-search-page-sidebar
[filters]="state.filters"
(filtersChange)="changeFilters($event)">
</my-search-page-sidebar>
</div>
<div class="content">
<h2>Search</h2>
<my-search-page-query-input
[value]="state.query"
@jtomaszewski
jtomaszewski / iptables.sh
Created November 24, 2013 17:55
A basic, example iptables file you can use to configure your VPS.
#!/bin/sh
iptables -F
iptables -X
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A FORWARD -o lo -j ACCEPT
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED
@jtomaszewski
jtomaszewski / asyncable.rb
Created February 16, 2014 01:09
Allow instance methods to be delayed to Sidekiq
# Idea from http://krautcomputing.com/blog/2012/10/07/how-to-make-everything-background-processable-through-sidekiq/
#
# Usage:
#
# class Synchronization
# include Asyncable
# end
#
# Then:
# Synchronization.find(12).perform_async(:synchronize, 3, 2)
@jtomaszewski
jtomaszewski / app_run.coffee
Created January 7, 2015 15:47
Ionic Framework: Turn off animations on Android and iOS 6 devices.
app.config ($injector) ->
model = ionic.Platform.device().model or ""
animateNavigation = ionic.Platform.grade == "a"
unless animateNavigation
defaults =
'$ionicNavBarConfig':
transition: 'no-animation'
'$ionicNavViewConfig':
transition: 'no-animation'
@jtomaszewski
jtomaszewski / multi_column_clearance.sass
Created January 31, 2014 12:34
Bootstrap 3 Grid Multi Column Clearing
// See issue https://github.com/twbs/bootstrap/issues/8810 for more information.
//
// Thanks for the idea of the fix to:
// https://github.com/sixfootsixdesigns/Bootstrap-3-Grid-Columns-Clearing
@import "bootstrap/variables"
// Useful @media mixins (based on dimensions taken from bootstrap-sass)
=media-width-below($max)