Skip to content

Instantly share code, notes, and snippets.

@gbakernet
gbakernet / configureStore.js
Last active February 23, 2017 02:22
Thought Experiment using redux-saga to do react server side rendering with express
import { createStore } from "redux"
// Simple Reducer for mock data
export default () => {
const reducer = (state = {}, action) => {
switch (action.type) {
case "DATA_LOADED":
return { heading: `Hello World! ${Date.now()}` }
default:
return state
@gbakernet
gbakernet / keybase.md
Created October 12, 2016 00:51
keybase.md

Keybase proof

I hereby claim:

  • I am gbakernet on github.
  • I am gbakernet (https://keybase.io/gbakernet) on keybase.
  • I have a public key whose fingerprint is 5DF0 2049 61AF 358C 1FC6 C3EE 97EF A4FD A717 CAE6

To claim this, I am signing this object:

@gbakernet
gbakernet / app.js
Last active July 2, 2018 10:46 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4 with quick and dirty SSR support
// Preserve the server render markup
// This has to run before the root render
let preservedMarkup = {}
if (typeof document !== "undefined") {
[...document.querySelectorAll("[data-async-component]")].map(node =>
preservedMarkup[node.getAttribute("data-async-component")] = node.innerHTML
)
}
// getComponent is a function that returns a promise for a component
@gbakernet
gbakernet / sassmacros.xml
Created May 18, 2012 08:33
Sass Macros for Ant
<?xml version="1.0"?>
<!--
# Sass Macros for Ant
# http://github.com/gbakernet
# Authored 2012 Glenn Baker; Licensed MIT */
<sass> Usage - Compile sass files
* jarpath - is path to jruby-complete.jar and gem-sass.jar
* src - input
* dest - output
@gbakernet
gbakernet / fiddle.css
Created January 12, 2012 09:13
JS Fiddle Template
/* Mad CSS */
@gbakernet
gbakernet / es6proxy.htm
Created September 8, 2011 22:52 — forked from nzakas/es6proxy.htm
Example of ES6 Proxy
<!DOCTYPE html>
<!--
This is a simple experiment relying on ECMAScript 6 Proxies. To try this out,
use Aurora (http://www.mozilla.org/en-US/firefox/channel/).
The goal was to create a HTML writer where the method names were really just
the HTML tags names, but without manually creating each method. This uses
a Proxy to create a shell to an underlying writer object that checks each
method name to see if it's in a list of known tags.
"npm install socket-io" & you are ready to go
@gbakernet
gbakernet / iife-helper.js
Created March 22, 2011 06:21
Immediately-Invoked Function Expression Helper
/* IIFE Helper */
function iife( dep, fn ) { fn.apply( fn, dep ); }
/* Usage: Closure where the arguments read at the top of your code */
iife([ window, document, jQuery ],
function( win, doc, $) {
//Lengthy code goes here
console.log( arguments )
});
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}