Skip to content

Instantly share code, notes, and snippets.

View simonsmith's full-sized avatar

Simon Smith simonsmith

View GitHub Profile
Running "suitcss:component" (suitcss) task
component-resolver remote not set - defaulting to remotes's defaults +0ms
component-resolver:locals resolving local at "/Users/simonsmith/Sites/grunt-suitcss/test/fixtures/component" +0ms
component-resolver resolving "component-test" +5ms
component-resolver:dependencies resolving dependency suitcss/[email protected] +0ms
component-resolver:dependencies searching ["local","github","bitbucket"] for suitcss/[email protected] +0ms
component-resolver remaining dependencies: 1 +6ms
component-resolver remaining semver: 0 +0ms
component-resolver finished resolving locals +0ms
component-resolver:dependencies found suitcss/[email protected] from remote "local" +3ms
(function(context) {
var factories = {}, loaded = {};
var isArray = Array.isArray || function(obj) {
return obj.constructor == Array;
};
var map = Array.map || function(arr, fn, scope) {
for (var i = 0, len = arr.length, result = []; i < len; i++) {
result.push(fn.call(scope, arr[i]));
}
@simonsmith
simonsmith / jasmine-type-matchers-lodash.js
Last active August 29, 2015 14:00
Jasmine type matchers (native and underscore/lodash)
/**
* Add matchers for different types
* Note that Function.prototype.bind is not supported in PhantomJS
* Uses underscore/lodash
*
* Usage: expect('test').toBeString();
*/
!function() {
'use strict';
@simonsmith
simonsmith / hotkeys.md
Created May 16, 2014 11:05
List of Bash hotkeys for Mac

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)
@simonsmith
simonsmith / utils-size.scss
Created June 19, 2014 18:43
Sizing utility classes for Sass
/**
* 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
*/
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 / space.styl
Created September 4, 2014 12:41
SUIT CSS spacing utils in stylus
/**
* 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
@simonsmith
simonsmith / with-feature-detect.js
Last active August 29, 2015 14:07
Flight mixin for adding `is-` SUIT classes to a component based on Modernizr support
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 / example.js
Created March 16, 2015 00:23
Compiling SUIT with gulp and postcss
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() {
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',