Skip to content

Instantly share code, notes, and snippets.

@michaelgmcd
michaelgmcd / style-components.js.flow
Created March 14, 2017 02:25
Flow declaration file for styled-components
// @flow
type Interpolation = ((executionContext: Object) => string) | string | number;
type StyledComponent = (
strings: Array<string>,
...interpolations: Array<Interpolation>
) => ReactClass<any>;
declare module 'styled-components' {
declare var exports: {
(baseComponent: ReactClass<any>): StyledComponent,
##################### Elasticsearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
#
# Elasticsearch comes with reasonable defaults for most settings,
@michaelgmcd
michaelgmcd / gulpfile-simple.js
Created August 19, 2015 17:32
A simple gulpfile for hosting static files with browsersync, compiling SASS files, and reloading/injecting the browser when needed.
var gulp = require('gulp');
var gulpSass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var sourcemaps = require('gulp-sourcemaps');
var prefix = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
gulp.task('scss', function() {
return gulp.src('style.scss')
.pipe(sourcemaps.init())
@michaelgmcd
michaelgmcd / gulpfile-complete.js
Last active June 14, 2018 19:10
Complete gulpfile used for AngularJS, SASS, Browser-Sync, Bower, Karma, and Image minification
/*
* Gulpfile
* @author Michael McDermott
* Created on 5/12/15.
*/
'use strict';
var gulp = require('gulp');
var path = require('path');
@michaelgmcd
michaelgmcd / Nav.js
Created August 10, 2015 22:04
Sticky navbar in React.js
var React = require('react');
var ExecutionEnvironment = require('react/lib/ExecutionEnvironment');
var cx = require('classnames');
var Nav = React.createClass({
componentDidMount: function() {
if (ExecutionEnvironment.canUseDOM) {
window.addEventListener('scroll', this.handleScroll, false);
}
},