Skip to content

Instantly share code, notes, and snippets.

@rgrove
rgrove / README.md
Created February 8, 2016 19:01
Cake's approach to React Router server rendering w/code splitting and Redux

Can't share the complete code because the app's closed source and still in stealth mode, but here's how I'm using React Router and Redux in a large app with server rendering and code splitting on routes.

Server

  1. Wildcard Express route configures a Redux store for each request and makes an addReducers() callback available to the getComponents() method of each React Router route. Each route is responsible for adding any Redux reducers it needs when it's loaded. (This isn't really necessary on the
{
"ROOT" => {
"Old Testament" => [
'Genesis',
'Exodus',
'Leviticus',
'Numbers',
'Deuteronomy',
'Joshua',
'Judges',
@line-o
line-o / SandBox.js
Created October 6, 2012 19:09
Evaluate JavaScript code in a configurable Sandbox (no Iframes here)
var SandBox = (function (realCtx) {
var get = realCtx.document.getElementById.bind(realCtx.document),
_evil = eval;
return {
init: function (form, script, ctx) {
this._form = get(form);
this._script = get(script);
this.fakeCtx = ctx;
this._form.onsubmit = SandBox.evaluate;
@jaydeepw
jaydeepw / enableHTML5AppCache.java
Last active October 5, 2023 11:39
Enabling HTML5 AppCache in Android Webview programatically.
private void enableHTML5AppCache() {
webView.getSettings().setDomStorageEnabled(true);
// Set cache size to 8 mb by default. should be more than enough
webView.getSettings().setAppCacheMaxSize(1024*1024*8);
// This next one is crazy. It's the DEFAULT location for your app's cache
// But it didn't work for me without this line
webView.getSettings().setAppCachePath("/data/data/"+ getPackageName() +"/cache");
@tshm
tshm / agility-localStorage.js
Created March 20, 2012 12:45
agilityjs - localStorage adapter
/*
[MIT licensed](http://en.wikipedia.org/wiki/MIT_License)
*/
// custom agilityjs adapter for localstorage
(function($$, console) {
'use strict';
$$.adapter.localStorage = function(_params) {
var storageKey = (this._data.persist.baseUrl || '') + this._data.persist.collection,
storageStr = localStorage[storageKey],