Skip to content

Instantly share code, notes, and snippets.

View ChrisBAshton's full-sized avatar

Chris Ashton ChrisBAshton

View GitHub Profile
@ChrisBAshton
ChrisBAshton / module_base.js
Last active February 11, 2024 23:01
Best base for a JavaScript library
// 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 () {
};
/*
<div class="results">
<div class="results_top">
<h2>Results</h2>
</div>
<div class="results_bottom">
<div class="share"></div>
</div>
.alignleft {
float: left;
}
.longtext {
@text (length < 300) {
overflow: hidden;
}
}
@ChrisBAshton
ChrisBAshton / cucumber-recipes-cherrypicked.md
Last active December 8, 2015 16:24
Cucumber Recipes Cherry-picked

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
@ChrisBAshton
ChrisBAshton / cheatsheet.md
Created April 11, 2016 12:08
My personal highlights from the new ES6 standard

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 / node-security.js
Last active October 2, 2016 18:41
Security in JavaScript
var customRequest;
(function () {
function CustomRequestModule () {
function isSafeUrl (url) {
return url === 'https://safe-site.com';
}
function getAccessToken () {
return 'my top secret access token';
}
@ChrisBAshton
ChrisBAshton / amp-embed.html
Last active February 4, 2018 18:07
Documenting how the wrapper API works
<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 / aria-keyshortcuts.html
Last active June 21, 2018 21:29
Keyboard accessibility gists
<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 / do-you-agree.html
Last active December 9, 2018 15:50
Screen reader gists
<label>
Important: We can only hold details of one trip at a time.
<input type="checkbox" /> Tick to confirm you have read this. *
</label>
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"targets": {
"chrome": "58",
"ie": "11"
}