Skip to content

Instantly share code, notes, and snippets.

View colinmeinke's full-sized avatar

Colin Meinke colinmeinke

View GitHub Profile
@colinmeinke
colinmeinke / hello_world.js
Last active December 19, 2015 07:09
Mocha Chai unit testing
// Load the assertion library
var chai = require('chai'),
should = chai.should();
describe('Hello world example', function() {
// This should pass
it('should be a string', function() {
var hello_world = 'hello world';
hello_world.should.be.a('string');
@colinmeinke
colinmeinke / Preferences.sublime-settings
Last active December 19, 2015 21:19
Sublime user preferences
{
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_size": 20,
"rulers": [
62,
80
]
}
@colinmeinke
colinmeinke / README.md
Last active December 20, 2015 20:48
Front-end structure

#Front-end structure

A set of rules to organise big front-end code. This experiment in extreme abstraction would allow for encapsulation of your front-end modules. It could be the base for development of a set of common front-end patterns.

##Block structure

All HTML, CSS and JS should be contained within the blocks directory.

/public/blocks/block_name/...
@colinmeinke
colinmeinke / _unit.scss
Last active October 22, 2021 21:36
Sass remify/emify mixins
// Defaults
$base_font_size: 16px;
$rem_fallback: true;
// Usage: rem(16px);
@function rem(
$size,
$base_font_size: $base_font_size
) {
@return #{$size / $base_font_size}rem;
@colinmeinke
colinmeinke / structure.markdown
Last active December 27, 2015 16:39
Tea round REST API

##GET:

  • /users
  • /users/1
{
    "id": 1,
    "name": "Colin",
 "drinks_requested": 10,

#Learn a skill from a real life person


[X] Hi, I’m Luke

Learn Ruby in 4 hours
Sat 15th Nov 2014, 1pm - 5pm
London, UK

@colinmeinke
colinmeinke / text_box.html
Last active August 29, 2015 14:10
An example of how Uniform JS classes and BEM views work well together to create modular front-end code
<div class="text-box">
<h1 class="text-box__title">
Hello world
</h1>
<p class="text-box__description">
Description
</p>
</div>
@colinmeinke
colinmeinke / class-naming.md
Last active August 29, 2015 14:16
Class naming

Harry Roberts has written an epic article where he suggests breaking down classes into objects (o-), components (c-), utilities (u-), themes (t-), states (is-, has-) and a couple of others (_, js-, qa-). He uses this namespacing method to make the code he writes more readable and maintainable at scale.

I've got a slightly different take on it. I would argue that Harry's method of adding class types adds complexity to our CSS. With BEM naming conventions and Sass I believe

@colinmeinke
colinmeinke / es2016.js
Last active August 29, 2015 14:25
Async JS
const getArticles = async () => {
try {
const response = await fetch( 'articles.json' );
const data = await response.json();
data.articles.forEach( article => {
let { author, title } = article;
console.log( `${title} written by ${author}` );
});
} catch ( e ) {
@colinmeinke
colinmeinke / Button.jsx
Created October 1, 2015 17:29
React inline styles
import React, { Component } from 'react';
import { baseStyle, loadingStyle } from './buttonStyle';
class Button extends Component {
render () {
return (
<button
style={{
...baseStyle,
...( this.props.isLoading ? loadingStyle : {}),