Skip to content

Instantly share code, notes, and snippets.

View a-double's full-sized avatar

Aaron Wells a-double

View GitHub Profile
@a-double
a-double / css.css
Created May 28, 2020 20:56
SVG Fragments
.icon {
background-image: url('[SVG LINK].svg#fragment-id');
}
@a-double
a-double / OLOO.js
Created November 9, 2016 15:37
Objects linking to other objects
var Wrapper = {
create: function() {
return Object.create( Wrapper );
},
stuff: function() {
console.log( 'stuff' );
}
};
@a-double
a-double / numeric-input.css
Created April 19, 2016 20:25
Remove up/down buttons from numeric input
// For WebKit
::-webkit-inner-spin-button, ::-webkit-outer-spin-button {
-webkit-appearance: none;
}
// For Mozilla
input[type="number"] {
-moz-appearance: textfield;
}
@a-double
a-double / component.js
Created January 25, 2016 14:08
Handling "this" in React with ES6
import React from 'react';
class Thing extends React.Component {
constructor( props ) {
super( props );
this.handleClick = this.handleClick.bind( this );
}
handleClick() {
@a-double
a-double / composition.js
Created January 22, 2016 22:24
JS Composition
const puncher = ( state ) => ({
punch: () => console.log( `My name is ${ state.name } and I can punch.` );
});
const kicker = ( state ) => ({
kick: () => console.log( `My name is ${ state.name } and I can kick.` );
});
const fighter = ( name ) => {
let state = {
@a-double
a-double / default-override.js
Last active January 20, 2016 20:10
ES6 default/override pattern
// https://gist.github.com/ericelliott/f3c2a53a1d4100539f71
// Eric Elliott
function foo({
param = 'stuff',
another = 'things'
} = {}) {
return `${param} and ${things}`;
}
@a-double
a-double / .babelrc
Created January 8, 2016 16:15
Basic Gulpfile for React/Babelify/Browserify
{
"presets": [ "es2015", "react" ],
"plugins": [ "transform-decorators-legacy" ]
}
@a-double
a-double / tooltip-arrows.css
Last active September 24, 2015 16:33
Tooltip Arrows
/* Based on http://cssarrowplease.com, I just forget the URL all the time */
.tooltip {
position: relative;
background: #fff;
border: 1px solid #ddd;
}
.tooltip::before, .tooltip::after {
content: '';
bottom: 100%;
@a-double
a-double / flex-embeds.css
Created March 11, 2015 21:31
Flexible media embeds
/* https://github.com/suitcss/components-flex-embed/blob/master/lib/flex-embed.css */
.flex-embed {
display: block;
position: relative;
overflow: hidden;
}
.flex-embed-inner {
display: block;
@a-double
a-double / jquery.allowNumeric.js
Last active August 29, 2015 14:16
jQuery plugin script to only allow numeric values in text fields.
$.fn.allowNumeric = function() {
return this.on( 'keyup', function() {
this.value = this.value.replace( /[^0-9\.]/g, '' );
});
};