Skip to content

Instantly share code, notes, and snippets.

View thevangelist's full-sized avatar
⛩️

thevangelist

⛩️
  • Taitopilvi
  • 0.98327 - 1.017 AU
View GitHub Profile
@thevangelist
thevangelist / my-component.spec.js
Created August 4, 2016 13:06
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
$static: './assets';
.television {
background: url(#{$img}/gray-noise.png);
}
<meta name="viewport" content="minimal-ui, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="App">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon" sizes="57x57" href="favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="favicons/apple-touch-icon-120x120.png">
@thevangelist
thevangelist / extends.scss
Created September 8, 2016 12:37
How to compose with SCSS ($extend property)
.message {
border: 1px solid #ccc;
padding: 10px;
color: #333;
}
.success {
@extend .message;
border-color: green;
}
@thevangelist
thevangelist / convert-to-kebab-case.js
Created September 21, 2016 10:11
JS: convert to kebab-case
const convertToKebabCase = (string) => {
return string.replace(/\s+/g, '-').toLowerCase();
}
@thevangelist
thevangelist / version.sh
Created September 30, 2016 08:45
Semver versioning with git tags & npm version
#!/bin/sh
# Convenience script for versioning
# Pass a semver-formatted version number to this script such as `npm version 2.1.0`.
#
# You'll get:
# 1) git tag such as v2.1.0
# 2) new version to `package.json`
npm version $1
@thevangelist
thevangelist / resize.sh
Created October 28, 2016 07:24
Resize Image With One Max Dimension and Maintain Aspect Ratio
#!/bin/sh
sips -Z 200 img.jpg
img { display: none; } /* Sorry! */
p { text-align: justify; }
a {
color: #0066B3;
text-decoration: none;
}
a:hover {
@thevangelist
thevangelist / flexbox-product-grid.css
Last active December 13, 2016 15:35
Flexbox Product Grid Blog Post (2016/11)
.flex {
display: flex; /* Make products flex in row direction (default) */
flex-wrap: wrap; /* Make products overflow on new row */
justify-content: center; /* Or space-between or space-around */
}
.flex > section {
flex: 1 1 0; /* Prevent the extra space around content */
text-align: center; /* Align text on center */
display: flex; /* Display as flex */
@thevangelist
thevangelist / flexbox-product-grid.html
Last active December 13, 2016 15:36
Flexbox Product Grid Blog Post (2016/11)
<div class="flex">
<section>
<img src="img.jpg" alt="description" />
<h2>Product</h2>
<p>Description</p>
<aside>
<ul>
<li>Spec</li>
<li>Spec</li>
</ul>