Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Ashton ChrisBAshton

View GitHub Profile
View .babelrc
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"targets": {
"chrome": "58",
"ie": "11"
}
View do-you-agree.html
<label>
Important: We can only hold details of one trip at a time.
<input type="checkbox" /> Tick to confirm you have read this. *
</label>
@ChrisBAshton
ChrisBAshton / aria-keyshortcuts.html
Last active Jun 21, 2018
Keyboard accessibility gists
View aria-keyshortcuts.html
<div class="a11y-help">
Press opt + / to open this menu
</div>
<div aria-label="Navigation Assistant" aria-keyshortcuts="Alt+/" role="menubar">
<a class="screen-reader-shortcut" tabindex="1" href="#main-content">
Skip to main content
</a>
</div>
@ChrisBAshton
ChrisBAshton / amp-embed.html
Last active Feb 4, 2018
Documenting how the wrapper API works
View amp-embed.html
<amp-iframe src="https://news.files.bbci.co.uk/include/newsspec/15996-trump-tracker/english/index/amp" width="640" height="360">
<!-- some other AMP elements here -->
</amp-iframe>
@ChrisBAshton
ChrisBAshton / node-security.js
Last active Oct 2, 2016
Security in JavaScript
View node-security.js
var customRequest;
(function () {
function CustomRequestModule () {
function isSafeUrl (url) {
return url === 'https://safe-site.com';
}
function getAccessToken () {
return 'my top secret access token';
}
@ChrisBAshton
ChrisBAshton / cheatsheet.md
Created Apr 11, 2016
My personal highlights from the new ES6 standard
View cheatsheet.md

Amazing levels of awesomeness

These are the features I've wished JavaScript always had, and can't wait to start using.

Classes

class Shape {
    constructor (id, x, y) {
        this.id = id
        this.move(x, y)
@ChrisBAshton
ChrisBAshton / cucumber-recipes-cherrypicked.md
Last active Dec 8, 2015
Cucumber Recipes Cherry-picked
View cucumber-recipes-cherrypicked.md

Advanced Cucumber Techniques

The following tips and tricks have been cherry-picked from 'Cucumber Recipes', by Dees, Wynne and Hellesøy. ~ Chris Ashton

Native Cucumber magic

These things are built into Cucumber, and you may not even know it.

Define steps as regular ruby methods

Given /^I am on a page for (.+) seconds$/, :visit_the_page
View intelligent-text-overflow.css
.alignleft {
float: left;
}
.longtext {
@text (length < 300) {
overflow: hidden;
}
}
View css-dom-position.css
/*
<div class="results">
<div class="results_top">
<h2>Results</h2>
</div>
<div class="results_bottom">
<div class="share"></div>
</div>
@ChrisBAshton
ChrisBAshton / module_base.js
Last active Aug 29, 2015
Best base for a JavaScript library
View module_base.js
// shamelessly taken from Imager - https://github.com/BBC-News/Imager.js/blob/master/Imager.js
// develop your JavaScript library to support RequireJS/CommonJS/vanilla JavaScript
;(function (window, document) {
'use strict';
var Imager = function () {
};