Skip to content

Instantly share code, notes, and snippets.

View localnerve's full-sized avatar

Alex Grant localnerve

View GitHub Profile
@localnerve
localnerve / ccss.js
Created November 5, 2016 13:16
Compile css build step w/o svg2png fallback
/***
* Copyright (c) 2016 Alex Grant (@localnerve), LocalNerve LLC
* Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
*/
import gulp from 'gulp';
import gulpSvgmin from 'gulp-svgmin';
import gulpSass from 'gulp-sass';
import gulpPostcss from 'gulp-postcss';
import gulpIf from 'gulp-if';
import gulpCssmin from 'gulp-cssmin';
<!--
Copyright 2016 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
<html>
<body>
<h1>Hello World</h1>
<p>This is a test of an html file as a gist</p>
</body>
</html>
@localnerve
localnerve / flux-react-example-sw-debug-snippet
Created March 29, 2016 02:09
Snippet to add visionmedia/debug flag to IndexedDB for service-worker
(function () {
var request = window.indexedDB.open("service-worker", 1);
request.onerror = function (event) {
console.error('failed to open service-worker database', request.errorCode);
};
request.onsuccess = function (event) {
var db = event.target.result;
var transaction = db.transaction(['state'], 'readwrite');
@localnerve
localnerve / renderHtmlIntoDocument.md
Created December 22, 2015 18:47
React 0.14.x HTML Element, Replacement for ReactTestUtils.renderIntoDocument, React / jsDom / Unit Testing

React 0.14.x TestUtils.renderIntoDocument replacement for html elements

  /**
   * renderIntoDocument for html element.
   * Replaces testUtils.renderIntoDocument.
   *
   * testUtils.renderIntoDocument no longer supports React html components as it wraps
   * everything in a div:
   * https://github.com/facebook/react/issues/5128
@localnerve
localnerve / flux-react-example-main-size-snapshot-20151118.md
Created November 18, 2015 20:18
flux-react-example main bundle contributors 20151118 (77k compressed), settings bundle contained (#35)
  • react: 624.7 kB (58.7%)
  • lodash: 74.46 kB (7.00%)
  • fluxible: 52.71 kB (4.95%)
    • dispatchr: 24.11 kB (45.7%)
      • eventemitter3: 7 kB (29.0%)
    • setimmediate: 6.29 kB (11.9%)
    • is-promise: 165 B (0.306%)
  • fluxible-router: 52.11 kB (4.90%)
    • routr: 18.22 kB (35.0%)
  • path-to-regexp: 9.25 kB (50.7%)
@localnerve
localnerve / gist:c7081a619878ef5b6f50
Last active August 29, 2015 14:26 — forked from giosakti/gist:3027026
[Git] Fetch & merge upstream/downstream repo
git remote add <upstream>/<repo> ssh://git@bitbucket.org/<upstream>/<repo>.git
git fetch <upstream>/<repo>
git checkout master
git merge remotes/<upstream>/<repo>/master
@localnerve
localnerve / gist:31b77ad56da309fa9d97
Last active August 29, 2015 14:16
jsDom React Testing - getMarkupWrap - Markup wrapping node not initialized. A friendly module-monkey-patch and module-state reminder courtesy of React.
/*
While debugging using jsdom with react tests, I reminded myself of "when" module code executes.
In doing so, I also reminded myself how to monkey patch loaded modules.
Happy remembering!
*/
beforeEach(function() {
// setup jsdom
testDom();
// tell react DOM is usable
@localnerve
localnerve / gist:16a6154dccad6a0e631f
Last active August 29, 2015 14:16
Mac Yosemite WebDev Setup

Setup Steps

  1. Get Homebrew package manager. These instructions are reasonable to get homebrew setup.

  2. Github for mac (if you plan on using GH, BB, or other Git service without having to cmdline everything).

  3. Shell and Command Line Stuff

@localnerve
localnerve / react-starter-error
Last active August 29, 2015 14:06
webpack/react-starter error --display-error-details
agrant@bitbuckler:~/var/www/content/react-test$ npm run build
> react-starter@0.0.0 build /home/agrant/var/www/content/react-test
> webpack --config webpack-production.config.js --progress --profile --colors --display-error-details
61878ms build modules
2ms optimize
2ms hashingg
13ms create chunk assets
1ms additional chunk assets