Skip to content

Instantly share code, notes, and snippets.

Simon Smith simonsmith

Block or report user

Report or block simonsmith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .vscode-settings
{
"editor.lineNumbers": "relative",
"workbench.colorTheme": "Horizon Bold",
"editor.minimap.enabled": false,
"editor.cursorBlinking": "solid",
"peacock.favoriteColors": [
{
"name": "Angular Red",
"value": "#b52e31"
},
@simonsmith
simonsmith / load-script.js
Created Nov 6, 2018
Simple script loader
View load-script.js
const scripts = {};
function loadScript(src) {
if (scripts[src]) {
return scripts[src];
}
const script = document.createElement('script');
script.async = true;
View unit.js
const tape = require('tape');
const test = require('tape-css')(tape);
const h = require('hyperscript');
const getStyle = require('computed-style');
const $ = selector => document.querySelector(selector);
const styles = require('./my-component.css');
const dom = () => (
h('div.MyComponent',
@simonsmith
simonsmith / example.js
Created Mar 16, 2015
Compiling SUIT with gulp and postcss
View example.js
var gulp = require('gulp');
var bemLinter = require('postcss-bem-linter');
var atImport = require('postcss-import');
var cssnext = require('cssnext');
var postcss = require('gulp-postcss');
var concat = require('gulp-concat');
var notify = require('gulp-notify');
var stylus = require('gulp-stylus');
gulp.task('css', function() {
@simonsmith
simonsmith / with-feature-detect.js
Last active Aug 29, 2015
Flight mixin for adding `is-` SUIT classes to a component based on Modernizr support
View with-feature-detect.js
module.exports = withFeatureDetect;
function withFeatureDetect() {
'use strict';
this.addFeatureDetectClass = function(feature, supported) {
var prefix = (supported ? 'is-' : 'is-not-');
this.$node.addClass(prefix + feature + '-enabled');
};
@simonsmith
simonsmith / space.styl
Created Sep 4, 2014
SUIT CSS spacing utils in stylus
View space.styl
/**
* Spacing utilities
*
* Used to override styles on components without need for
* additional modifier classes
*
* Usage:
* <div class="u-mbZ"> // margin-bottom: 0
* <div class="u-mt20"> // margin-top: 20px
* <div class="u-m25"> // margin: 25px
View function-bind.js
Function.prototype.bind = (function() {
}).bind || function(b) {
if (typeof this !== "function") {
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
function c() {
}
var a = [].slice, f = a.call(arguments, 1), e = this, d = function() {
return e.apply(this instanceof c ? this : b || window, f.concat(a.call(arguments)));
@simonsmith
simonsmith / utils-size.scss
Created Jun 19, 2014
Sizing utility classes for Sass
View utils-size.scss
/**
* Spacing classes
*
* Used to override styles on components without need for
* additional modifier classes
*
* Usage:
* <div class="u-mbZ"> // margin-bottom: 0
* <div class="u-mt20"> // margin-top: 20px
*/
@simonsmith
simonsmith / hotkeys.md
Created May 16, 2014
List of Bash hotkeys for Mac
View hotkeys.md

Bash Keyboard Shortcuts - Mac

Enable Option Key as Meta in iTerm. Set as Esc+ - http://stackoverflow.com/a/438892

Moving the cursor

  • Ctrl + a Go to the beginning of the line (Home)
  • Ctrl + e Go to the End of the line (End)
  • Ctrl + p Previous command (Up arrow)
  • Ctrl + n Next command (Down arrow)
You can’t perform that action at this time.